DEV Community

Cover image for How to Pull allegro.cz Results into Python with Allegro.cz Scraper
ReventaData
ReventaData

Posted on Originally published at apify.com

How to Pull allegro.cz Results into Python with Allegro.cz Scraper

By the end of this tutorial you will have a Python script that searches allegro.cz, the Czech marketplace, and prints one block per offer: price in CZK, seller, rating and delivery text. The example searches for playstation 5 among used offers and drops offers whose title or seller login contains one of four Czech words: controller, game, cover and cable. The site's search is fuzzy, so the sample holds games, one console and PS2 and PS3 items.

Allegro.cz Scraper (reventadata/allegro-cz-scraper) is the Apify Actor that reads the public search pages. You give it search terms and a few filters, and it returns one row per distinct offer. You write no scraping code. The Python script only starts the Actor and reads its rows.

The example run returned 30 rows. The sample rows in this post are the first 10 of them, copied unedited.


Prerequisites

You need three things:

  1. Python 3.11 or newer. The Apify client for Python 3.x requires it.
  2. A free Apify account, which you can create with an email address or a GitHub login.
  3. Your Apify token, which the script reads from an environment variable.

Install the client and export the token:

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

The Actor is unofficial and not affiliated with Allegro. It reads public pages, so the search needs no login.


What you'll achieve

You will run one search for playstation 5, limited to used offers. The Actor keeps only offers whose title contains playstation, saves up to 30 of them, and returns the rows to Python, which prints them cheapest first.

Each row holds the price as a number with its currency, the seller's login, the seller's positive-feedback percentage, the product rating when there is one, the delivery text from the card and the product parameters. A field the Actor did not get a value for is null.

The condition, price band, free-delivery, Super Seller and sort options are applied by the site. The run stops with an error if the site did not apply one, so you never get unfiltered rows labelled as filtered.


Step 1: Describe the search

The run takes one input object. This is the exact input of the example run:

{
    "searchQueries": ["playstation 5"],
    "condition": "used",
    "includeKeywords": ["playstation"],
    "excludeKeywords": ["ovladac", "hra", "kryt", "kabel"],
    "maxItems": 30
}
Enter fullscreen mode Exit fullscreen mode
  • searchQueries: a list of search terms, one search each. It is required.
  • condition: any, new or used. Any other value is refused before the run starts.
  • includeKeywords: every word in the list must appear in the title or the seller login.
  • excludeKeywords: an offer is dropped when one of these words appears in the title or the seller login. Matching ignores case and accents.
  • maxItems: the most rows saved across all search terms. The default is 100.

Other inputs are minPrice and maxPrice in CZK, freeDelivery, superSellerOnly, sortBy (relevance, price-asc or price-desc) and includeSponsored, which is on by default.


Step 2: Start the run and read the rows

The script starts the Actor, waits for it to finish, reads the default dataset and prints one block per offer.

import os
from apify_client import ApifyClient

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

# 2. Describe the search: playstation 5, used offers, on allegro.cz
run_input = {
    "searchQueries": ["playstation 5"],
    "condition": "used",
    "includeKeywords": ["playstation"],
    "excludeKeywords": ["ovladac", "hra", "kryt", "kabel"],
    "maxItems": 30,
}

# 3. Start the Actor and wait for it to finish
run = client.actor("reventadata/allegro-cz-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)} offers.\n")

# 5. Print one block per offer, cheapest first: price, seller, rating and delivery text
for item in sorted(items, key=lambda row: row["price"]):
    rating = item.get("ratingAverage") or "none shown"
    print(f"{item['price']} {item['currency']} | {item['title']}")
    print(f"  seller: {item['sellerLogin']}, rating: {rating}")
    print(f"  {item.get('deliveryLabel') or 'no delivery text'}")
Enter fullscreen mode Exit fullscreen mode

call() returns the run once it has finished. Its status is a string such as SUCCEEDED, and default_dataset_id names the dataset that holds the rows. list_items().items is the list of rows, each one a dictionary.


Step 3: Read one row

This is the first row of the example run, unedited. Every row has the same keys, and a missing value is null.

{
    "id": "19019010086",
    "title": "PS5 - PlayStation®5 Digital Edition - 825GB",
    "url": "https://allegro.cz/nabidka/19019010086",
    "price": 13999,
    "currency": "CZK",
    "pricePerUnit": null,
    "imageUrl": "https://a.allegroimg.com/s180/118a83/e99d2901439497470ecb90c0383a/Sony-PlayStation-5-Slim-Digital-Edition-Dva-roky-zaruka-STAV-A",
    "sellerLogin": "Secondhandgusto",
    "sellerId": "126439378",
    "sellerUrl": "https://allegro.cz/uzivatel/Secondhandgusto",
    "sellerSuperSeller": false,
    "sellerPositiveFeedbackPercent": 72.7,
    "ratingAverage": 4.95,
    "ratingCount": 603,
    "popularityLabel": "168 lidí nedávno koupilo",
    "deliveryLabel": "doručení za 0 Kč se Smart!",
    "parameters": {
        "Stav": [
            "použité"
        ],
        "Verze": [
            "PlayStation 5 Slim Digital Edition"
        ]
    },
    "productId": "6fc003c3-b9b7-4874-a7b6-76d11434d56b",
    "productOffersCount": 20,
    "listingType": "regular",
    "matchedKeyword": "playstation 5",
    "page": 1,
    "scrapedAt": "2026-11-16T09:42:35.138365+00:00"
}
Enter fullscreen mode Exit fullscreen mode

Understanding your results

  • price and currency: the price as a number. Every row of the example run is in CZK.
  • listingType: regular or sponsored, as the page marks the offer. Set includeSponsored to false to drop sponsored rows. In the sample, one row is sponsored and nine are regular.
  • sellerLogin, sellerSuperSeller, sellerPositiveFeedbackPercent: the seller's public login, the Super Seller flag and the positive-feedback percentage. Seven rows of the sample share one seller login.
  • ratingAverage and ratingCount: the product rating and its number of ratings. In the sample, ratingAverage is null on three rows.
  • deliveryLabel: the delivery text on the card. The sample has doručení za 0 Kč se Smart! (delivery for 0 CZK with Smart) on eight rows and doručení od 0 Kč se Smart! (delivery from 0 CZK with Smart) on two.
  • parameters: product parameters keyed by name. Stav, the condition, reads použité (used) on every sample row.

Pro tips and advanced usage

  • Sort on the site with sortBy: "price-asc" or "price-desc". Those two directions were checked against the prices the site returned. Relevance is the site's default.
  • includeKeywords is a plain substring test, so a keyword of 5 would also match 25. Use a longer keyword when a short one matches too much.
  • Set minPrice and maxPrice to bound the search. The site applies the band, and the Actor checks each row against it again.
  • Test with a small maxItems. The run stops once that many rows are saved, so a test with 5 rows returns at most 5.
  • maxItems counts rows saved, not pages read. A page holds about 60 distinct products, so a maxItems of 30 is less than one page.
  • Run the script on a schedule with whatever scheduler you already use, and keep each run's dataset ID so batches can be compared later.

Troubleshooting common issues

  • Refused before the run starts. A value outside its list, such as "condition": "second-hand", stops the run before it starts.
  • Empty search terms. If searchQueries has no non-blank entry, the run fails and asks for at least one search term.
  • A filter the site did not apply. The run stops with an error rather than returning unfiltered rows.
  • No matches. A run whose search matched nothing ends as SUCCEEDED with a status message. A run the site refused ends as FAILED, with the reason in its log.
  • Where to look. The run log in Apify Console lists each result page as the Actor reads it.

Next steps

Change the search terms or condition, add a price band, or put the script on a schedule. Share your results in the comments, and tell us which search you tried.

For current pricing and details, see the Store page.

What would you search for on allegro.cz? Drop a comment!

About the author: reventadata builds and publishes data extraction Actors on the Apify Store.

Top comments (0)