By the end of this tutorial you will have a Python script that pulls used car listings from bilbasen.dk, Denmark's vehicle marketplace, into structured rows: make, model, trim, asking price in kroner, mileage, first registration date, fuel type, gearbox and the seller's city.
Bilbasen Denmark Car Scraper (reventadata/bilbasen-scraper) is the Apify Actor that reads the public search pages and returns one row per car. You send it a search URL and a few optional filters, and it returns the rows. Bilbasen is a trademark of its owner, and this Actor is not affiliated with Bilbasen.
The sample output below comes from a real run on 16 November 2026 with a 10-car limit, not from an invented example. That run took about 20 seconds.
Prerequisites
You need three things:
- Python 3.11 or newer, because the Apify client for Python 3.x requires it.
- A free Apify account, which you can create with an email address or a GitHub login.
- Your API token, from your Apify account settings.
Install the client and export the token:
pip install -U "apify-client~=3.0"
export APIFY_API_TOKEN="your_apify_token_here"
No scraping code is needed on your side. The Actor does the reading.
What you'll achieve
You will search bilbasen.dk for used cars and read the rows in Python. The example asks for the first page of the all-cars search and stops at 10 listings. It then prints two lines per car: make, model, trim, price, mileage, city, fuel type and gearbox.
The same script covers other searches. Add priceMax to cap the asking price in kroner, fuelType for electric or hybrid cars, or carType for an SUV or a station wagon. Only the input changes.
Step 1: Open Bilbasen Denmark Car Scraper
Open the Bilbasen Denmark Car Scraper page on Apify Store. The Try for free button there opens the Actor in Apify Console. This tutorial uses the API from Python, so you only need the Actor name, reventadata/bilbasen-scraper.
Step 2: Choose the search
The search is described by a handful of input fields:
-
searchQueries: a list of Bilbasen search URLs or paths. The example useshttps://www.bilbasen.dk/brugt/bil, the all-cars search. A URL from another site ends the run as FAILED with a message about the input. -
maxItems: the most rows the run saves, across all queries. Default 100. -
maxPages: the most result pages read per query. A page holds 30 cars. -
priceMinandpriceMax: asking price limits in Danish kroner (DKK). -
carType: one ofsuv,stationcar,mikro,cuv,mpv,sedan,hatchback,cabrioletorcoupe. -
fuelType: one ofElectric,Benzin,Diesel,ElectricAndBenzin,ElectricAndDiesel,ElectricAndBenzinPluginorElectricAndDieselPlugin.
A value outside the carType or fuelType list is refused before the run starts. The input schema lists those values, and the platform checks input against the schema before it starts any run.
The example uses the input from the run:
{
"searchQueries": ["https://www.bilbasen.dk/brugt/bil"],
"maxItems": 10,
"maxPages": 1
}
Step 3: Run it from Python
This script starts the Actor, waits for it, reads the dataset and prints two lines per car:
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: the first page of used cars on bilbasen.dk, 10 listings
run_input = {
"searchQueries": ["https://www.bilbasen.dk/brugt/bil"],
"maxItems": 10,
"maxPages": 1,
}
# 3. Start the Actor and wait for it to finish
run = client.actor("reventadata/bilbasen-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)} cars.\n")
# 5. Print two lines per car
for item in items:
print(f"{item.get('make')} {item.get('model')} {item.get('variant')} | {item.get('displayPrice')} | {item.get('mileageDisplay')}")
print(f" {item.get('city')}, {item.get('region')} | {item.get('fuelType')}, {item.get('gearType')} | first registered {item.get('firstRegistrationDate')}")
The Actor walks the results one page at a time and stops when the pages run out or the run reaches maxItems, so keep maxPages small while you test.
Step 4: Read the output
The loop prints one block per car. This is the start of the output from the 16 November 2026 run with the input above. The first three of the ten cars are shown:
Retrieved 10 cars.
VW Polo 1,0 TSi 95 Comfortline DSG 5d | 147.900 kr | 60.000 km
Stenløse, Nordsjælland | Benzin, Automatisk gear | first registered 5/2021
Citroën C3 1,2 PureTech 83 Attraction 5d | 86.900 kr | 81.000 km
Stenløse, Nordsjælland | Benzin, Manuelt gear | first registered 1/2023
Mercedes EQC400 AMG Line 4Matic 5d | 389.000 kr | 23.000 km
Risskov, Østjylland | El, Automatisk gear | first registered 11/2021
...
Each car is one dictionary in items. The price arrives twice: price as a number of kroner, and displayPrice as text such as 147.900 kr.
Step 5: Read one full row
This is one row from the same run, exactly as the Actor returned it, with two cuts: the long description field is left out, and images shows two of its eighteen photo links.
{
"id": "7034230",
"externalId": 7034230,
"url": "https://www.bilbasen.dk/brugt/bil/vw/polo/10-tsi-95-comfortline-dsg-5d/7034230",
"make": "VW",
"model": "Polo",
"variant": "1,0 TSi 95 Comfortline DSG 5d",
"doors": 5,
"price": 147900,
"displayPrice": "147.900 kr",
"originalPrice": null,
"currency": "kr",
"priceType": "Retail",
"sellerType": "Forhandler",
"saleType": "Detailsalg",
"city": "Stenløse",
"zipCode": 3660,
"region": "Nordsjælland",
"latitude": 55.771523,
"longitude": 12.198352,
"firstRegistrationDate": "5/2021",
"mileageKm": 60000,
"mileageDisplay": "60.000 km",
"fuelType": "Benzin",
"gearType": "Automatisk gear",
"horsepower": 95,
"horsepowerDisplay": "95 hk",
"annualTaxDisplay": "1.600 kr/år",
"towingWeightKg": 1000,
"accelerationDisplay": "11,3 sek",
"electricRangeKm": null,
"batteryCapacityKwh": null,
"kmPerLiterDisplay": "17,9 km/l",
"images": [
"https://billeder.bilbasen.dk/bilinfo/14801a33-18a1-4719-93ef-b010cca7c2f7.jpeg?class=S640X640",
"https://billeder.bilbasen.dk/bilinfo/a508b5f8-a8f2-4850-9eb9-489ccc4f0584.jpeg?class=S640X640"
],
"searchQuery": "https://www.bilbasen.dk/brugt/bil",
"page": 1,
"scrapedAt": "2026-11-16T20:53:13.000Z"
}
Understanding your results
Each row is one car, and most fields are plain values you can filter on. price and mileageKm are numbers. displayPrice and mileageDisplay are the same figures as text, such as 3.445 km. mileageKm is the digits of that text, so 3.445 km becomes 3445.
In this run, sellerType is Forhandler on all ten rows. The schema lists Forhandler and Privat as the two values. fuelType reads El on six rows, Benzin on three and Plug-in on one.
Some fields are empty on some rows in this run:
-
originalPricehas a value on one row only. On that row it is 149900 andpriceis 154900, so the field is lower than the price there. Check the listing before you read it as a discount. -
electricRangeKmandbatteryCapacityKwhare empty on the three petrol cars (Benzin). -
kmPerLiterDisplayis empty on all six electric cars and filled on the other four. -
towingWeightKgis empty on three electric cars, and one petrol car shows0. -
imagesis an empty list on one row.
Pro tips
- Keep
maxPagesat 1 while you test. A page holds 30 cars, andmaxItemscaps the rows whatever the page count. - Narrow the search in the input.
fuelTypeandcarTypeonly accept the values listed in Step 2. - Pass several searches in
searchQueriesto read them in one run. A car that shows up on more than one page in the same run is saved once. - Save the
idfield from each run if you compare runs over time. It is the listing's number on Bilbasen. - Run the script on a schedule with cron or a similar tool, then append each run's rows to a file.
Troubleshooting
If the script prints Run did not succeed (status: FAILED), open the run in Apify Console. The status message and the log say why: an input problem, such as a search URL from another site, or a page the site refused.
If the script prints Retrieved 0 cars. and the run shows SUCCEEDED, the search matched nothing. A search with no rows is a finished run with a status message, not a failure.
Next steps
Try a second search by pasting the SUV search URL from bilbasen.dk into searchQueries, then add priceMax and see how the rows change. Schedule the script once it works. The Apify Python client documentation at https://docs.apify.com/api/client/python covers the rest of the calls.
For current pricing and details, see the Store page.
About the author: reventadata builds and publishes data extraction Actors on the Apify Store.
Top comments (0)