Unofficial Scraper API for OLX.CO.ID
You can install the package using npm or Yarn:
npm install olx-scraper
or
yarn add olx-scraper
To log in to OLX:
const { OLXClient } = require("olx-scraper");
const client = new OLXClient('[email protected]', 'your-password');
client.loginOLX().then(response => {
console.log(response);
}).catch(error => {
console.error(error);
});
Retrieve user data from OLX by user ID:
client.getUserData(userId, cookie).then(userData => {
console.log(userData);
}).catch(error => {
console.error(error);
});
Get a list of categories available on OLX:
client.getCategory().then(categories => {
console.log(categories);
}).catch(error => {
console.error(error);
});
Search for listings in a specific category:
client.searchbyCategory(categoryId, locationId).then(searchResults => {
console.log(searchResults);
}).catch(error => {
console.error(error);
});
Search for locations on OLX:
client.searchLocation('location-query').then(locations => {
console.log(locations);
}).catch(error => {
console.error(error);
});