Hierarchy

  • Brainly

Constructors

  • Parameters

    • country: CountryList = 'id'

      Here, please put your application server country code. if you do not enter valid region/country code. It will trigger an Error Exception.

    • enabledCache: boolean = true

      Brainly Cache condition, you can disable/enable it.

    • useZadaneCookie: boolean = true

      Use zadane cookie to request

    Returns Brainly

Properties

#cookieZadane: string = ''

Zadane cookie

cache: Cache

Brainly cache manager instance.

The caches saved on /tmp folder. Don't worry, the caches will removed every machine reboot.

country: CountryList = 'id'
enabledCache: boolean = true
worker: Piscina = ...

Brainly worker pool (using npmjs.com/piscina)

Methods

  • Find a Brainly User's Information.

    Returns

    Parameters

    • country: CountryList

      The user's country (you must fill it correctly)

    • userId: string | number

      User's id (you can use Util.convertId(author.databaseId, 'user') to fill it)

    • options: AxiosRequestConfig<any> = {}

      Additional axios request options

    Returns Promise<undefined | Author>

  • Use this function if you want search question, it will returns question detail, question author, answer detail, attachments (if question or answer attachments is any), rating question and answer.

    Description

    This method based on constructor country code.

    Returns

    Parameters

    • question: string

      A question you want to search. Example: Pythagoras theory

    • language: CountryList = 'id'

      What language want to search?

    • length: number = 10

      Length array from question list

    • options: AxiosRequestConfig<any> = {}

      Custom Axios request options

      Example:

       brain.search('Pythagoras', 'id', 10).then(console.log);
      

    Returns Promise<{
        answers: Answer[];
        question: Question;
    }[]>

  • Use this function if you want search question, it will returns question detail, question author, answer detail, attachments (if question or answer attachments is any), rating question and answer.

    Description

    Find question by ID

    Returns

    Parameters

    • id: string | number

      The question ID

    • language: CountryList = 'id'

      The language of question (you should fill it correctly)

    • options: AxiosRequestConfig<any> = {}

      Axios request configurations

      Example:

      brain.searchById(52885142);
      // OR
      brain.searchById('cXVlc3Rpb246NTI4ODUxNDI=');

    Returns Promise<undefined | {
        answers: Answer[];
        question: Question;
    }>

  • Use this function if you want search question, it will returns question detail, question author, answer detail, attachments (if question or answer attachments is any), rating question and answer.

    Description

    • You can use this method if you won't receive 403 forbidden.

    Returns

    Parameters

    • question: string

      A question you want to search. Example: Pythagoras theory

    • language: CountryList = 'id'

      What language want to search?

    • length: number = 10

      Length array from question list

    • options: AxiosRequestConfig<any> = {}

      Custom Axios request options

      Example:

       brain.searchWithMT('Pythagoras', 'id', 10).then(console.log);
      

    Returns Promise<{
        answers: Answer[];
        question: Question;
    }[]>

  • This function will return brainly site url from your country selection in the constructor

    Returns

    Parameters

    • country: CountryList

      A base url of your country selection

    Returns string

  • Get body request to sent.

    Returns

    Parameters

    • query: string

      Operation query name

    • vars: Record<string, unknown>

      Variables want to sent

    Returns Promise<{
        operationName: string;
        query: undefined | string;
        variables: Record<string, unknown>;
    }[]>

  • Initialize the brainly scraper v2 resources

    Returns

    Returns Promise<number>

  • Validate language code based available languages.

    Returns

    Parameters

    Returns boolean

Generated using TypeDoc v0.23.16