Skip to content

luisbrandino/brainly-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠
✨ 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

Releases

No releases published

Packages

No packages published