This library retrieves data from Brainly that has been designed to avoid 403 Forbidden
exception.
To avoid such errors, you can fill in a valid country code. You can test the 10 languages or country codes available to see if your server hosting country location or location is rejected.
See https://github.com/hansputera/brainly-scraper-languages/blob/master/AVAILABLE_LANGUAGES.md
- Using NPM :
npm install brainly-scraper-v2
- Using YARN :
yarn add brainly-scraper-v2
WARNING: Make sure the country code you entered in the constructor is correct.
- Code
const Brainly = require("brainly-scraper-v2");
const brain = new Brainly("id"); // 'id' - Default to 'id'
brain.search("es", "Pythagoras").then(console.log).catch(console.error);
- Output
[
{
"question": {
"id": 5070014,
"content": "Pythagoras nació en el año 580 a.c y murió en el año 501. ¿Que edad tenia Pythagoras Cúando murió?",
"attachments": [],
"author": {
"id": 3467036,
"avatar_url": "https://es-static.z-dn.net/files/d9d/8f696cce4d637d278ba011b6159642b8.jpg",
"deleted": false,
"url": "https://brainly.lat/app/profile/3467036",
"rank": "Aspirante",
"username": "BeeluuCabj"
}
},
"answers": [
{
"content": "Como nació y murió a.c.... \n" +
"-501-(-580) -- -501+580= 79... Edad que tenía cuando murió.",
"attachments": [],
"rates": 4,
"rating": 3.75
}
]
}, { ... }
]
If you have problems using this library, you can create an issue in the github repository. Remember, don't forget to read the instructions and try.
Free and paid hosting replit already tested. The country codes that pass are Indonesia, Spain, India, Portuguese, and Philipines.
Ever tried and tested on other hosting? Please send us your feedback in PR. That would be very helpful 😊.
Do you want to contribute with this library for the better? Very well, fork this github repository then install dependencies to your directory. Happy coding 😁