Complete Guide: How to Scrape DBA Listings Using Python
Run the DBA Scraper Apify Actor from Python and turn dba.dk marketplace searches into structured rows with prices, locations and seller details.

This guide provides a comprehensive tutorial on extracting second-hand marketplace listings from dba.dk using Python. Whether you need to monitor price movements, track specific electronics, or build automated alerts for bargains across Denmark, you will learn how to turn marketplace searches into clean, structured dataset records.
The primary tool for this task is DBA Scraper (reventadata/dba-scraper), an Apify Actor specifically designed to search dba.dk (Den Blå Avis, Markedspladsen) and return structured listing data. You interact with it directly from Python using the official Apify API client, requiring no local browser dependencies or custom parsers.
By following this tutorial, you will discover which input parameters the Actor accepts, how it applies filters on the site, what attributes each record provides, and where the platform's pagination ceilings lie. Every metric and row presented in this walkthrough reflects an authentic run of an iPhone search on DBA, extracting 10 structured items in 4.616 seconds without fabricated figures or simulated output.
TL;DR
In this tutorial, you will execute reventadata/dba-scraper using Python's apify-client library. You will supply search parameters including searchQueries and optional price thresholds (minPrice, maxPrice), trigger the Actor run on Apify, and collect structured rows containing listing titles, prices in DKK, geographical coordinates, seller categories, and delivery flags. You will also learn how the Actor manages DBA's 50-page pagination ceiling and how to automate periodic runs using schedules. The tool is available on the DBA Scraper page on Apify Store.
Prerequisites and setup
To execute the Actor programmatically, your local development environment requires three components:
- Python 3.11 or newer: The Apify Python client 3.x series requires Python 3.11 or above for modern asynchronous operations and typed models.
- An Apify account: If you do not have one yet, you can sign up for free using an email address or your GitHub account. Apify Console provides a central management interface for Actors, runs, and storage.
- Your API token: Obtain this token from Settings > API & Integrations in the Apify Console.
Install the Apify client package and export your API token as an environment variable in your shell:
pip install -U "apify-client~=3.0"
export APIFY_API_TOKEN="your_apify_token_here"
No external scraping packages, browser drivers, or proxy configurations are needed on your local machine.
Understanding DBA Scraper
DBA Scraper executes search requests on Denmark's established second-hand classifieds portal, dba.dk. For every keyword provided in your search configuration, the Actor queries the marketplace and normalizes each ad into a standardized dictionary.
Each result contains 19 fields covering commercial, logistical, and geographic dimensions: unique ad identifier, canonical listing URL, asking price in DKK, locality, geographic latitude and longitude, seller category (distinguishing private individuals from registered businesses), delivery availability flags, platform badge labels, and timestamps.
The Actor operates under specific platform constraints. DBA provides up to 53 listings per page and caps pagination at 50 pages per search query (approximately 2,650 listings). Queries with broader inventory must be subdivided into discrete price ranges to collect items past the 50-page ceiling. Price filtering can be applied directly using minPrice and maxPrice, allowing you to narrow searches before data extraction. In addition, the Actor supports keyword matching filters that confirm the query terms appear within listing titles or brand fields across Danish text.
Step-by-step walkthrough
Step 1: Open the Actor
Begin by visiting the DBA Scraper page on Apify Store. Clicking Try for free opens the Actor in Apify Console, enabling manual testing and schema exploration. For Python integration, note the technical name reventadata/dba-scraper.
Step 2: Configure search parameters
The Actor configuration accepts several input parameters defined in its schema:
searchQueries: A list of search terms or keywords (for example["iphone"]). This parameter is mandatory.minPriceandmaxPrice: Optional integer boundaries in DKK. These limits are sent directly to DBA's search engine, which filters results before returning listings. IfminPriceexceedsmaxPrice, the Actor raises an input validation error.maxItems: An integer cap on the total number of items saved across all queries. The default is 100.maxPages: An integer cap on pagination pages per query. DBA limits search pagination to a ceiling of 50 pages (roughly 2,650 items).shippingOnly: A boolean flag. When set totrue, the Actor keeps only listings that offer package delivery.requireKeywordMatch: A boolean flag enabled by default. It confirms that the query terms appear in the listing's title or brand before storing the row, using Danish letter folding for characters like ø and æ.
A typical configuration searching for iPhones looks like this:
{
"searchQueries": ["iphone"],
"maxItems": 10,
"maxPages": 1
}
Step 3: Run the Actor from Python
The following Python script initializes the Apify client, executes the Actor with your configured input, waits for completion, and prints a structured summary from the default dataset:
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: iPhone listings on DBA
run_input = {
"searchQueries": ["iphone"],
"maxItems": 10,
"maxPages": 1,
}
# 3. Start the Actor and wait for it to finish
run = client.actor("reventadata/dba-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.\n")
# 5. Print two lines per listing: title, price, location, seller type and shipping
for item in items:
price = item.get("price")
currency = item.get("currency")
price_str = f"{price} {currency}" if price is not None else "no price stated"
shipping = "shipping offered" if item.get("shippingAvailable") else "pickup only"
print(f"{item.get('title')} | {price_str} | {item.get('location')}")
print(f" seller: {item.get('sellerType')}, {shipping}, brand: {item.get('brand')}")
The script verifies that run.status equals SUCCEEDED before fetching dataset items. In the Apify Python SDK 3.x, call() returns a typed run object with direct attribute access.
Step 4: Examine the output
Executing the script against DBA produces a concise output block for each extracted listing. On our sample run of 10 items, the first three listings printed the following lines:
Iphone x pro max, iphone x, iphone 6, iphone 5 | 200 DKK | Brøndby Strand
seller: private, pickup only, brand: Apple
Iphone 16 Pro | 4650 DKK | Dragør
seller: private, pickup only, brand: Apple
Apple iPhone 15 128 GB | 2800 DKK | Charlottenlund
seller: private, shipping offered, brand: Apple
Notice that two listings require local pickup while the third supports shipping. All three listings clearly identify the seller type as private.
Working with the Apify API
The apify-client library provides programmatic access to Apify's execution environment. When you trigger an Actor using client.actor(...).call(), the client initiates the run asynchronously on the platform and blocks locally until execution concludes.
Once the run finishes with status SUCCEEDED, data can be retrieved immediately from the default dataset. Calling client.dataset(run.default_dataset_id).list_items().items returns all parsed listing dictionaries directly into structured Python memory for subsequent filtering or transformation.
For large datasets, you can iterate over rows using pagination with offset and limit parameters, or download the entire dataset stream directly into memory. In data pipelines requiring automated processing, you can convert items into a pandas DataFrame or export them to external cloud storage buckets.
Beyond direct API polling, you can automate runs using native platform features. A scheduled task can invoke the Actor at predetermined intervals, ensuring your database remains synchronised with new marketplace ads. In addition, platform webhooks can dispatch HTTP POST requests to your application upon run completion, allowing downstream ingestion scripts to process new batches automatically without continuous polling. When dealing with extensive datasets containing thousands of records, you can stream results using iterate_items() to process items one by one without loading the entire collection into memory at once. You can also specify memory allocation and execution timeout limits directly in your call parameters to control platform resource consumption.
Advanced search patterns
Complex monitoring operations often require querying multiple product categories or tracking items across disparate price bands:
- Multi-query collection: Pass several terms within the
searchQueriesarray (such as["iphone 15", "iphone 16"]). The Actor iterates through each query in sequence. It tracks previously encountered ad IDs in an internal set to ensure that an ad matching multiple queries is stored only once in the dataset, preventing duplicated records across keyword sweeps. - Server-side price slicing: If a search query yields more results than DBA's 50-page pagination limit (~2,650 listings), divide the search into narrower price segments using
minPriceandmaxPrice. Because DBA filters by price directly on its servers, each slice accesses a distinct result set without wasted fetches, allowing you to systematically capture large inventory catalogs. - Delivery-only filtering: When purchasing items from another Danish region, set
shippingOnlytotrue. Listings without shipping support are filtered out after extraction, saving downstream processing overhead and focusing on items you can receive by mail. - Keyword validation: The Actor's
requireKeywordMatchsetting inspects listing titles and brands, folding Danish characters (such as translating ø to o and æ to ae) to guarantee that only relevant ads remain in your final dataset.
Understanding your data
Every dataset row contains structured fields capturing key listing metadata:
id: Unique identifier assigned by DBA.titleandurl: Listing headline and canonical link on dba.dk.priceandcurrency: Asking price in Danish kroner (DKK).location: Locality or town specified by the seller.latitudeandlongitude: Geographic coordinates of the listing.postedAtandscrapedAt: ISO 8601 UTC timestamps for publication and extraction.sellerTypeandorganisationName: Indicatesprivateordealer. For private sellers,organisationNameisnull.shippingAvailableandbuyNow: Booleans for delivery and instant checkout.labels: Array of badges such asPrivat,Fiks færdig, andKøb nu.
One record from our sample run (with imageUrls cut to its first entry):
{
"id": "8870736",
"title": "Apple iPhone 15 128 GB",
"url": "https://www.dba.dk/recommerce/forsale/item/8870736",
"price": 2800,
"currency": "DKK",
"location": "Charlottenlund",
"postedAt": "2026-11-15T20:41:38+00:00",
"latitude": 55.75534,
"longitude": 12.57482,
"imageUrls": [
"https://images.dbastatic.dk/dynamic/default/item/8870736/4c3f2b13-4241-4d4d-ae15-14a3590ed4d3"
],
"organisationName": null,
"sellerType": "private",
"shippingAvailable": true,
"buyNow": true,
"labels": [
"Fiks færdig",
"Køb nu",
"Privat",
"Fri fragt"
],
"brand": "Apple",
"tradeType": "Til salg",
"matchedKeyword": "iphone",
"scrapedAt": "2026-11-15T21:03:51.713890+00:00"
}
Troubleshooting guide
When developing automation scripts with DBA Scraper, several common execution scenarios may occur:
- Zero rows returned with status SUCCEEDED: The marketplace returned no listings matching your keyword and price criteria, or all matching items were filtered out by
shippingOnlyorrequireKeywordMatch. Verify that your search query matches active listings on dba.dk, and test with broader price bounds. - Run finishes with status FAILED: Input validation issues will fail the run before data collection starts. For example, providing an empty
searchQueriesarray or configuring aminPricegreater thanmaxPriceraises an immediate configuration error with a descriptive message explaining the mismatch. - Fewer items than maxItems: The search reached the final page of matching listings on DBA, or encountered the 50-page platform ceiling. If fewer rows appear, the query simply exhausted available listings on the site.
- Unpopulated organisation names: In DBA's data model, private individual sellers do not possess business entities. As a result,
organisationNameis intentionallynullfor private seller rows.
Best practices and next steps
For current pricing and details, see the Store page.
To build reliable data extraction workflows, keep initial test runs small by setting maxPages: 1 and maxItems: 10. When ready for production, configure an Apify schedule to automate recurring sweeps, and attach webhooks to forward newly harvested records to your database. Datasets can be retrieved in multiple formats using the dataset API, including JSON, CSV, XML, and Excel. Regularly review your keyword selections to capture seasonal marketplace trends across Denmark, and maintain clean storage hygiene by purging obsolete test runs from your Apify account.
About the author: reventadata builds and publishes data extraction Actors on the Apify Store.
About the author
- Hi, I'm the engineer behind ReventaData. I build pay-per-event Apify Actors that turn public marketplace, classifieds, jobs and real-estate sites into clean, reliable datasets. Here on Hashnode, I share practical tutorials on collecting structured web data with Python and Apify, and on putting it to work: price tracking, lead lists and market analysis. Explore our turnkey scrapers: https://apify.com/reventadata
Comments
Join the discussionNo comments yet. Be the first to comment.




