DEV Community

Gio Rich
Gio Rich

Posted on

Getting Marktplaats and 2dehands ads and prices as JSON with Python (no browser, robots.txt-friendly)

I built this actor; it's a paid tool on Apify with a free trial credit.

Marktplaats is where the Netherlands sells its used stuff: bikes, phones, sofas, cars, about 200,000 bike ads alone on a normal day. Its Belgian twin runs as 2dehands.be in Dutch and 2ememain.be in French. If you flip items, price something before you list it, or want to know what a Gazelle e-bike really goes for this week, those ads are the closest thing to a live price list for the Dutch and Belgian second-hand market.

There's no public API. I'm an 18-year-old engineering student, and I built Marktplaats & 2dehands Scraper to turn the search pages into clean rows. This post covers how it works, calling it from Python, what a row looks like, and a small project: a daily median price for one bike model.

How it works

The search and category pages (/q/fiets/, /l/fietsen-en-brommers/, /p/2/) embed their 30 results as JSON inside the page, so one plain HTTP request gives 30 ads with price, condition, city, date, attributes and photos. Ad pages embed the view count, favourites, the first posting time and whether the seller is a private person or a trader; includeDetails: true opens them.

The actor stays on the pages robots.txt allows: no internal search API and no /n/ filter paths. That means the site's own price and condition filters aren't used. Instead the actor applies its own filters to every page it reads, and ads it reads but drops are free.

Python example

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

run = client.actor("rel8ble/marktplaats-scraper").call(run_input={
    "sites": ["marktplaats.nl", "2dehands.be"],
    "searchQueries": ["iphone 13"],
    "conditions": ["used", "like_new"],
    "priceMin": 100,
    "priceMax": 400,
    "skipTopAds": True,
    "maxItems": 50,
})

for ad in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(ad["site"], "|", ad["title"], "|", ad["price"], "|", ad["city"])
Enter fullscreen mode Exit fullscreen mode

What a row looks like

Shortened, from a real run on 2ememain.be with details:

{
    "id": "m2465042584",
    "title": "Iphone 13 blanc",
    "price": 300,
    "priceType": "bidding_from",
    "condition": "Comme neuf",
    "conditionCode": "like_new",
    "delivery": "Enlèvement ou Envoi",
    "city": "Bornem",
    "postedDate": "2026-11-12",
    "isTopAd": false,
    "categoryName": "Téléphonie mobile | Apple iPhone",
    "postedAt": "2026-11-12T16:45:05Z",
    "viewCount": 86,
    "favoritedCount": 2,
    "sellerType": "private",
    "site": "2ememain.be"
}
Enter fullscreen mode Exit fullscreen mode

conditionCode is the same in Dutch and French (new, like_new, used, not_working), so rows from all three sites can go in one table.

Project: a daily median price for one model

import json, os, statistics, datetime
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("rel8ble/marktplaats-scraper").call(run_input={
    "searchQueries": ["gazelle chamonix"],
    "categories": ["fietsen-en-brommers"],
    "mustInclude": ["chamonix"],
    "excludeKeywords": ["gezocht", "onderdelen"],
    "skipTopAds": True,
    "postedWithinDays": 1,
    "maxItems": 0,
})
prices = [ad["price"] for ad in client.dataset(run["defaultDatasetId"]).iterate_items() if ad["price"]]

HISTORY = "chamonix.json"
history = json.load(open(HISTORY)) if os.path.exists(HISTORY) else {}
today = datetime.date.today().isoformat()
if prices:
    history[today] = statistics.median(prices)
    print(f"{len(prices)} ads, median EUR {history[today]:.0f}")
json.dump(history, open(HISTORY, "w"), indent=1)
Enter fullscreen mode Exit fullscreen mode

Run it daily on cron or an Apify schedule. A day of ads for one model is a few dozen rows, a few cents a month.

Things to know

  • Price: $0.50 per 1,000 ads, details included, no start fee.
  • 5,010 ads per search: the site serves at most 167 pages of 30. Split big searches by category.
  • Top ads first: paid "Dagtopper" ads sit on top of each page; skipTopAds leaves them out.
  • 2dehands.be and 2ememain.be are the same ads in two languages; pick one for Belgium.
  • No personal data: no seller names, phones or e-mails; only a numeric seller id, and phone numbers typed into descriptions are masked.

Questions or broken fields: the Issues tab on the actor page comes straight to me.

Marktplaats & 2dehands Scraper on Apify


This article was drafted with AI and published by me.

Need a custom scraper or a ready dataset? Hire me on Fiverr: https://www.fiverr.com/rel8ble

Top comments (0)