DEV Community

Cover image for How to Scrape OLX Ukraine Laptop Listings with Python
ReventaData
ReventaData

Posted on Originally published at apify.com

How to Scrape OLX Ukraine Laptop Listings with Python

By the end of this tutorial you will have a short Python script that searches OLX.ua, the Ukrainian classifieds site, for a product and prints one line per listing: the asking price in UAH, the title, the town and the seller's public name. The example searches for laptops.

OLX Ukraine Scraper (reventadata/olx-ua-scraper) is the Apify Actor this tutorial uses. You give it one or more search terms and it returns one row per ad. You write no scraping code. The Actor reads the public search pages, and your Python script starts it and reads the rows back.

The sample rows in this post are a sample from a run dated 2026-11-20 with the input shown in Step 2: minPrice 1000 UAH, no condition and no sortBy, so the rows mix used and new laptops in the site's default order. They are a laptop search with one cooling-pad row. Long descriptions are shortened and marked with an ellipsis; nothing else is changed.


Prerequisites

You need three things:

  1. Python 3.11 or newer, because the Apify client for Python requires it.
  2. A free Apify account. You can sign up with an email address or a GitHub login.
  3. Your Apify API token, which you copy from the Apify Console.

Install the client and export the token in the terminal you will run the script from:

pip install -U "apify-client~=3.0"
export APIFY_API_TOKEN="your_apify_token_here"
Enter fullscreen mode Exit fullscreen mode

Nothing else is needed on your side.


What you'll achieve

Each dataset row is one ad. A row holds the ad's id, title, description, url, price in UAH, priceNegotiable, location, region, postedAt, refreshedAt, condition, attributes, isFeatured, isBusiness, the seller fields (sellerName, sellerId, sellerCompanyName, sellerMemberSince, sellerPhoneAvailable), the approximate map position and matchedKeyword, which names the search term that found the ad.

Example use case: a buyer who wants laptops above a minimum price, with the town and public name of each seller; add maxPrice, condition or sortBy for a narrower or ordered list. The same script works for any category on the site. Only the input changes.

Note on data: sellerPhoneAvailable tells you whether the seller published a phone number. The number itself is not in the row. Seller names and company names are the public fields the listing shows.


Step 1: Open the Actor

Open the OLX Ukraine Scraper page on Apify Store. It lists the input fields and the output fields. This tutorial calls the Actor from Python, so the only name you need is reventadata/olx-ua-scraper.


Step 2: Set the search inputs

The Actor takes its search from the input you pass to it. These are the fields the tutorial uses and the ones you are most likely to change:

Field Type Default What it does
searchQueries array Required One search per entry. Cyrillic and Latin terms both work.
condition string any any, new (Нове) or used (Вживане), as the site labels them.
sortBy string relevance relevance, priceAsc, priceDesc or newest. A few paid promoted ads appear whatever the sort, so the order is best-effort.
minPrice / maxPrice integer Empty Price range in UAH. Left out of the search when empty.
excludeFeatured boolean false Drops paid promoted placements when set to true.
requireKeywordMatch boolean true Drops ads whose title is missing a word of the search term.
maxItems integer 1000 Cap on rows across all search terms.
maxPages integer 25 Pages per search term. The site serves at most 25.

In your Python script, create the client and define the input:

import os
from apify_client import ApifyClient

# 1. Create the client with the token from your environment
client = ApifyClient(os.environ["APIFY_API_TOKEN"])

# 2. Define the search; the field names match the Actor's input fields
run_input = {
    "searchQueries": ["laptop"],
    "minPrice": 1000,
    "maxItems": 10,
    "maxPages": 1,
}
Enter fullscreen mode Exit fullscreen mode

Two notes on the input. The search term laptop is written in Latin, and it matches because the ad titles in the sample contain that word. If the titles spell your word another way, the title check drops those ads; set requireKeywordMatch to false to keep them.

To narrow the search, you can add "condition": "used" or "sortBy": "priceAsc" to the input. The sample rows were not produced with them.


Step 3: Run the Actor

The call below starts the run in Apify's cloud, waits for it to finish and returns a run object. The script checks run.status before it reads any rows.

# 3. Start the run and wait until it finishes
run = client.actor("reventadata/olx-ua-scraper").call(run_input=run_input)
if run is None or run.status != "SUCCEEDED":
    status = run.status if run else "unknown"
    raise SystemExit(f"Run did not succeed (status: {status}).")

# 4. Read the rows from the run's default dataset
items = client.dataset(run.default_dataset_id).list_items().items
print(f"Retrieved {len(items)} listings.")
Enter fullscreen mode Exit fullscreen mode

While the run works, the Actor reads the search pages in order, keeps the ads that pass the title check and writes each kept ad to the dataset. A search that matches nothing finishes without rows and with a status message, so the count printed above will be zero.


Step 4: Print the results

Once the run finishes, loop over the rows in items:

for item in items:
    print(f"Ad: {item.get('title')}")
    if item.get("price") is not None:
        print(f"  Price: {item['price']} {item.get('currency')}")
    if item.get("location"):
        print(f"  Town: {item['location']}, {item.get('region')}")
    if item.get("sellerName"):
        print(f"  Seller: {item['sellerName']}")
    print(f"  Link: {item.get('url')}")
    print("-" * 50)
Enter fullscreen mode Exit fullscreen mode

To save the rows, write items to a JSON file with json.dump(items, f, ensure_ascii=False, indent=2). The ensure_ascii=False argument keeps the Ukrainian text readable in the file.


Step 5: Read one row

This is one row from the sample, copied as the Actor returned it. The description is shortened.

{
  "id": "927822449",
  "title": "Ноутбук Microsoft Surface Laptop 4 / i7-1185G7 / 16GB / 256GB SSD / 15\" Touch / Уцінка",
  "description": "Ноутбук Microsoft Surface Laptop 4 / Intel Core i7-1185G7 / 16GB / 256GB SSD / 15\" Touch ...",
  "url": "https://www.olx.ua/d/uk/obyavlenie/noutbuk-microsoft-surface-laptop-4-i7-1185g7-16gb-256gb-ssd-15-touch-utsnka-ID10N30d.html",
  "imageUrl": "https://ireland.apollo.olxcdn.com:443/v1/files/11my6pehwjjl-UA/image;s=1000x750",
  "price": 15000,
  "priceNegotiable": true,
  "currency": "UAH",
  "location": "Луцьк",
  "region": "Волинська область",
  "postedAt": "2026-07-02T12:44:48+03:00",
  "refreshedAt": "2026-11-19T10:53:34+02:00",
  "condition": "Вживане",
  "attributes": {
    "state": "Вживане",
    "operating_system": "Windows",
    "laptop_weight": "1.51 - 2 кг",
    "display_size": "15\"-15,6\"",
    "laptop_manufacturer": "Microsoft"
  },
  "isFeatured": true,
  "isBusiness": true,
  "sellerName": "MyLaptop",
  "sellerId": "593209786",
  "sellerCompanyName": "MyLaptop",
  "sellerMemberSince": "2021-03-27T11:55:21+02:00",
  "sellerPhoneAvailable": true,
  "latitude": 50.74158,
  "longitude": 25.28939,
  "locationRadiusKm": 5,
  "matchedKeyword": "laptop"
}
Enter fullscreen mode Exit fullscreen mode

Understanding your results

  • price is the asking price in UAH. When an ad states no price, the field is null, never 0. In the sample, the laptop prices run from 5200 UAH to 33000 UAH.
  • priceNegotiable is true when the seller marked the price as negotiable. Some sample ads are marked negotiable and some are not, so check this field before you compare prices.
  • condition holds the site's own words, Нове (new) or Вживане (used). Most sample laptops are used; one is new.
  • location and region are the town and the region as OLX.ua names them, in Ukrainian.
  • attributes keeps the ad's structured fields under the keys OLX.ua uses, such as display_size and laptop_manufacturer. The keys differ from ad to ad. Some ads carry a for_gaming key with a null value, and others leave it out.
  • isFeatured marks a paid promoted placement. Those ads are mixed into the results and do not always follow sortBy.
  • description is the seller's own text. The sample's first row says the screen has a crack and that the price is lower because of it. The Actor returns that text as the seller wrote it.

Pro tips and advanced usage

  1. Narrow by price first. Set minPrice and maxPrice in UAH. The range is sent with the search, so the ads returned fall inside it.
  2. Turn off promoted placements for a clean list. Set excludeFeatured to true when you want organic ads only. Leave it off when the promoted ads matter to you.
  3. Use condition for a clean comparison. A used search keeps new ads out of a price list of second-hand goods, and a new search does the reverse.
  4. Keep maxItems small while you test. Start at 10, as in the example. Raise it once the fields look right.
  5. Schedule the run. Save the same input as a task in the Apify Console and attach a schedule to it.
  6. Read the seller's text. The description can say a device is damaged, and the title may not. Read it in full before you rank by price.

Troubleshooting common issues

  • Zero rows, and the run succeeded. No ad passed the search. Check the spelling of searchQueries first, or set requireKeywordMatch to false to see what the site returns for the term.
  • Run marked FAILED. The input is invalid, for example an empty searchQueries, or the site refused the run. Read the status message in the run log first.
  • A search stops early. The search ends at its last page, and the rows already saved stay in the dataset.
  • Price is null. The ad states no price. The row keeps the field with an empty value.

Next steps

For current pricing and details, see the Store page.

Helpful links:

Try a second search term next, and compare the two lists by their matchedKeyword values. What would you search for first? Drop your search term in the comments.

Top comments (0)