Skip to content

piotrv1001/olx-scraper-nodejs-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Scrape OLX Listings in Node.js

This example shows how to scrape OLX listings in Node.js using the OLX Listings Scraper actor on Apify. Instead of building a scraper from scratch, this repo demonstrates how to call the ready-made actor via the Apify API client — you get structured listing data in minutes.

OLX scraper results

What this example does

  • Calls the OLX Listings Scraper actor with a search query and optional filters
  • Passes the input configuration to the actor
  • Waits for the run to finish
  • Fetches results from the actor's dataset
  • Prints each listing item to the console

Prerequisites

Installation

npm install

Environment setup

Copy .env.example to .env and add your Apify API token:

cp .env.example .env

Then open .env and replace your_apify_token_here with your actual token:

APIFY_TOKEN=your_apify_token_here

Usage

npm start

Code example

import { ApifyClient } from 'apify-client';
import 'dotenv/config';

// Initialize the ApifyClient with your Apify API token
// Set APIFY_TOKEN in your .env file (copy .env.example to get started)
const client = new ApifyClient({
    token: process.env.APIFY_TOKEN,
});

// Prepare Actor input
const input = {
    "searchQuery": "iphone",
    "categoryIds": [],
    "startUrls": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/olx-listings-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

Example output

See sample-output.json for a full example. Each listing item contains:

Field Description
id Unique OLX listing ID
url Direct link to the listing page
title Listing title
description Full listing description text
price Price as a number
currency Currency code (e.g. PLN)
negotiable Whether the price is negotiable
condition Item condition (e.g. Używane = Used)
city / district / region Location details
lat / lon Geographic coordinates
sellerName / sellerId Seller info
isPromoted Whether the listing is a promoted ad
photos Array of photo URLs
params Category-specific attributes (model, storage, color, etc.)
createdAt / refreshedAt Listing timestamps
scrapedAt When the data was collected

Use cases

  • Price monitoring — track price trends for specific products across OLX Poland
  • Market research — analyze supply, demand, and pricing for categories like electronics or vehicles
  • Lead generation — find sellers listing items relevant to your business
  • Arbitrage — identify underpriced listings by comparing against market averages
  • Academic research — study second-hand market dynamics and consumer behavior in CEE markets

Try the actor on Apify

Open the OLX Listings Scraper on Apify

Related resources

License

MIT

About

Node.js example showing how to scrape OLX listings using the Apify OLX Listings Scraper actor

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors