An unofficial API for Brainly.
Use the package manager npm to install brainly-client.
Simply run:
npm install brainly-client
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 |