Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.09 KB

README.md

File metadata and controls

81 lines (58 loc) · 2.09 KB

🧠
✨ brainly-client ✨

Package Version Top language License

An unofficial API for Brainly.


🚀 Installation

Use the package manager npm to install brainly-client.

Simply run:

npm install brainly-client

💻 Quickstart

A simple example of usage:

const Client = require('brainly-client')
const brainly = new Client()

brainly.search('Test')
  .then(questions => {
    const question = questions[0]
    const answer = question.answers[0]

    console.log(question)
    console.log(answer)
  })

You can specify the number of questions you want to receive:

const Client = require('brainly-client')
const brainly = new Client()

brainly.search({ query: 'Test', first: 10 })
  .then(questions => {
    console.assert(questions.length <= 10)
  })

You can also define a different server (BR is default):

const Client = require('brainly-client')
const brainly = new Client({ server: 'ES' }) // Spain server

There are currently 9 servers you can use:

Country Code URL
Spain ES https://brainly.lat
Romania RO https://brainly.ro
India HI https://brainly.in
Poland PL https://brainly.pl
Philippines PH https://brainly.ph
Indonesia ID https://brainly.co.id
Turkey TR https://eodev.com
Russia RU https://znanija.com
Brazil BR https://brainly.com.br

⚠️ Be aware that some of them may be deprecated


📜 License

MIT