Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fdciabdul/olx-scraper
https://github.com/fdciabdul/olx-scraper
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/fdciabdul/olx-scraper
- Owner: fdciabdul
- License: gpl-3.0
- Created: 2023-11-24T01:43:08.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-03T00:59:39.000Z (3 months ago)
- Last Synced: 2024-11-01T07:51:51.643Z (19 days ago)
- Language: TypeScript
- Size: 50.8 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OLX Unofficial Client API
[![License: GPL-3.0 license](https://img.shields.io/github/license/fdciabdul/OLX-SCRAPER?style=plastic)](https://opensource.org/licenses/Artistic-2.0)
[![npm version](https://badge.fury.io/js/olx-scraper.svg)](https://badge.fury.io/js/olx-scraper)[![Open Source Love svg2](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)Unofficial Scraper API for OLX.CO.ID
## Installation
You can install the package using npm or Yarn:
```bash
npm install olx-scraper
```
or```bash
yarn add olx-scraper
```
## Usage### Logging in
To log in to OLX:
```javascript
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);
});
```### Fetching User Data
Retrieve user data from OLX by user ID:
```javascript
client.getUserData(userId, cookie).then(userData => {
console.log(userData);
}).catch(error => {
console.error(error);
});
```### Getting Categories
Get a list of categories available on OLX:
```javascript
client.getCategory().then(categories => {
console.log(categories);
}).catch(error => {
console.error(error);
});
```### Searching by Category
Search for listings in a specific category:
```javascript
client.searchbyCategory(categoryId, locationId).then(searchResults => {
console.log(searchResults);
}).catch(error => {
console.error(error);
});
```### Searching for Locations
Search for locations on OLX:
```javascript
client.searchLocation('location-query').then(locations => {
console.log(locations);
}).catch(error => {
console.error(error);
});
```