0.1.4 • Published 4 years ago
brainly-client v0.1.4
🚀 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 serverThere 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