#extracting #search #web-scraping #details #information #product #individual

bin+lib olx

A Rust library for extracting product information from OLX (www.olx.bg)

3 releases

0.1.2 Nov 25, 2023
0.1.1 Nov 24, 2023
0.1.0 Nov 24, 2023

#16 in #individual

30 downloads per month

GPL-3.0 license

16KB
223 lines

OLX Scraper

Overview

OLX Scraper is a Rust library for extracting product information from OLX (www.olx.bg). It provides functionalities for searching products within a specified price range and retrieving details about individual items using their URLs. Additionally, an optional command-line tool is included for convenient usage.

Features

  • Search Functionality: Search for products on OLX based on a query and optional price range.
  • Item Details: Retrieve detailed information about an item using its OLX URL.
  • Pagination Support: The search function supports pagination, allowing users to retrieve results from multiple pages.
  • Error Handling: The library gracefully handles errors during the search and item retrieval processes.

Installation

Add the following to your Cargo.toml file:

[dependencies]
olx-scraper = "0.1"

Usage

Library

use olx_scraper::search;

search::new("laptop", Some("elektronika/kompyutri/laptopi"), Some("500".to_string()), Some("1000".to_string()), Some("5"));
// Process the 'items' vector as needed

Command-Line Tool

olx-scraper search -q <query> [-m <min_price>] [-x <max_price>] [-p <end_page>] [ -c <category>]
  • : The search query.
  • <min_price> (optional): The minimum price filter.
  • <max_price> (optional): The maximum price filter.
  • <end_page> (optional): The page to end the search on
  • (optional): The category of the item you want to search for
olx-scraper get --url <item_url>
  • <item_url>: The URL of the item on OLX.

Examples

Search for Laptops Priced between $500 and $1000 in the category laptops

olx-scraper search -q laptop -m 500 -x 1000 -c elektronika/kompyutri/laptopi

Get Details of a Specific Item

olx-scraper get --url https://www.olx.bg/item/example-item

Dependencies

~7–19MB
~286K SLoC