Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Brainly

Index

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.

    Returns Brainly

Properties

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'
worker: Piscina = ...

Brainly worker pool (using npmjs.com/piscina)

Methods

  • search(question: string, language?: CountryList, length?: number, options?: AxiosRequestConfig<any>): 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

    This method based on constructor country code.

    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

    • Optional options: AxiosRequestConfig<any>

      Custom Axios request options

      Example:

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

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

    []>}

  • searchWithMT(question: string, language?: CountryList, length?: number, options?: AxiosRequestConfig<any>): 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
    • You can use this method if you won't receive 403 forbidden.

    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

    • Optional 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

    Parameters

    • country: CountryList

      A base url of your country selection

    Returns string

  • getRequestParams(question: string, length?: number): { operationName: string; query: string; variables: { len: number; query: string } }[]
  • Get body request to sent.

    Parameters

    • question: string

      A question

    • length: number = 10

      How much items you want to receive.

    Returns { operationName: string; query: string; variables: { len: number; query: string } }[]

    []}

  • Validate language code based available languages.

    Parameters

    Returns boolean

Generated using TypeDoc version 0.22.15, the 5/5/2022 at 7:24:56 PM