DEV Community

Cover image for How to Scrape AutoScout24.ch with Python and Apify
ReventaData
ReventaData

Posted on Originally published at apify.com

How to Scrape AutoScout24.ch with Python and Apify

By the end of this tutorial you will have a Python script that pulls used and new car listings from the Swiss AutoScout24 site into structured rows: asking price in Swiss francs, mileage, first registration, fuel, transmission and the seller. The rows are plain fields you can sort, filter or save to a spreadsheet.

The tool is AutoScout24 Switzerland Scraper (reventadata/autoscout24-ch-scraper), an Apify Actor that reads public listing pages and returns one row per car. You describe the search, and it does the reading.

The sample rows in this guide come from a real run of the Actor on 18 November 2026. Its dataset holds 20 rows, and the output blocks below show rows from that run, not invented examples.


Prerequisites

You need three things:

  1. Python 3.11 or newer, because the Apify client for Python 3.x requires it.
  2. A free Apify account.
  3. Your API token, from Settings > API & Integrations in Apify Console.

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

No scraping code is needed on your side. The Actor does the fetching, and it needs no login.


What you'll achieve

You will search for BMW cars, read the 20 rows in Python and print two lines per listing: the title, price, mileage and year, then the fuel, gearbox and seller type.

The same script works for a buyer comparing asking prices, a dealer watching new stock, or an analyst tracking how mileage and age relate to price. Only the input changes. You will also see how the make and price limits change the number of rows, and what the run reports when a search matches nothing. The fields you print come from the table of output fields in the results section below.


Step 1: Open the Actor

Open the AutoScout24 Switzerland Scraper page on Apify Store. This tutorial calls the Actor from Python, so you need only its name, reventadata/autoscout24-ch-scraper.


Step 2: Choose the search

The search is described by a few input fields:

  • make: the make as AutoScout24.ch spells it, for example bmw, audi, mercedes-benz or land rover. Empty means all makes. The run checks the make against the site's make list first. An unknown make ends the run as FAILED, and the status message lists the closest makes.
  • priceFrom and priceTo: whole Swiss francs (CHF). Left out of the search when empty.
  • sortBy: newest (the default) or priceAsc. Any other value is refused before the run starts.
  • maxItems: the cap on rows. The default is 100.
  • maxPages: the cap on result pages. Each page holds 20 listings.
  • fetchSellers: off by default. Turn it on to add the dealer's street address, phone numbers and website to each row, when the dealer published them. It makes the run slower.

A search for used Audis between 20,000 and 30,000 francs, cheapest first, would use this input. This is an example, not the run used in this guide:

{
    "make": "audi",
    "priceFrom": 20000,
    "priceTo": 30000,
    "sortBy": "priceAsc",
    "maxItems": 50,
    "maxPages": 3,
    "fetchSellers": true
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Run it from Python

This script starts the Actor, waits for it, reads the dataset and prints two lines per listing:

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: BMW cars, one page of 20 listings, newest first
run_input = {
    "make": "bmw",
    "maxItems": 20,
    "maxPages": 1,
}

# 3. Start the Actor and wait for it to finish
run = client.actor("reventadata/autoscout24-ch-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
for item in items:
    print(f"{item.get('title')} | {item.get('price')} CHF | {item.get('mileageKm')} km | first registered {item.get('firstRegistrationYear')}")
    print(f"  {item.get('fuelType')}, {item.get('transmission')}, {item.get('sellerType')} seller in {item.get('sellerCity')}")
Enter fullscreen mode Exit fullscreen mode

Keep maxPages small while you test. With maxPages set to 1 and the page size of 20, the run reads one page and stops.


Step 4: Read the output

The first three listings of the 20-row run print like this:

Retrieved 20 listings.

BMW X5 xDrive 30d Steptronic M-Sport | 44900 CHF | 47400 km | first registered 2020
  diesel, automatic, professional seller in Baar
BMW 123 xDrive M-SportPaket | 41900 CHF | 28500 km | first registered 2026
  mhev-petrol, semi-automatic, professional seller in Dietikon
BMW 25e xDrive paddles | 36800 CHF | 33000 km | first registered 2024
  phev-petrol, semi-automatic, private seller in Oberlunkhofen
Enter fullscreen mode Exit fullscreen mode

The run used the default sortBy, and in this run the rows arrive newest first, by creation time.


Step 5: Add the dealer contact details (optional)

Set fetchSellers to true and each row from a dealer gains sellerAddress, sellerPhone, sellerPhones (a list of numbers with their type) and sellerWebsite, if the dealer published them. If a dealer's profile cannot be read, that row still ships, without those four fields.

The run in this guide left fetchSellers off, so none of its 20 rows has the four fields.


Understanding your results

Each row has 34 fields in this run; the key ones:

  • price: the asking price in CHF. previousPrice: a second price field, null on all 20 rows of this run.
  • mileageKm, firstRegistrationDate, firstRegistrationYear: the odometer reading and the first registration.
  • fuelType is the code the site gives (diesel, petrol, mhev-diesel). horsePower and kiloWatts give the power.
  • transmission, condition, inspected, hadAccident, warrantyType: the car.
  • sellerType, sellerName, sellerCity, sellerZipCode: the seller.

One complete row from the same run (imageUrls cut to its first entry):

{
    "id": "21001077",
    "make": "BMW",
    "makeKey": "bmw",
    "model": "X5",
    "version": "X5 xDrive 30d Steptronic M-Sport",
    "price": 44900,
    "previousPrice": null,
    "mileageKm": 47400,
    "firstRegistrationDate": "2020-12-01",
    "firstRegistrationYear": 2020,
    "fuelType": "diesel",
    "horsePower": 265,
    "kiloWatts": 195,
    "transmission": "automatic",
    "condition": "used",
    "hadAccident": false,
    "hasNewTires": null,
    "hasAdditionalSetOfTires": true,
    "inspected": true,
    "warrantyType": "from-delivery",
    "teaser": "*CH-Fahrzeug*AHK.*8-fach bereift *360° Kamera*Head-Up-Display*Lenkradheizung*",
    "createdAt": "2026-11-18T07:24:53.558Z",
    "lastModifiedAt": "2026-11-18T07:46:30.047Z",
    "sellerId": 1759841,
    "sellerName": "Autohaus Baar AG",
    "sellerType": "professional",
    "sellerCity": "Baar",
    "sellerZipCode": "6340",
    "url": "https://www.autoscout24.ch/de/d/bmw-x5-xdrive-30d-steptronic-m-sport-21001077",
    "title": "BMW X5 xDrive 30d Steptronic M-Sport",
    "currency": "CHF",
    "imageUrl": "https://listing-images.autoscout24.ch/listing/77/21001077/82926296.JPG?w=400&q=90",
    "imageUrls": [
        "https://listing-images.autoscout24.ch/listing/77/21001077/82926296.JPG?w=400&q=90"
    ],
    "imageCount": 16
}
Enter fullscreen mode Exit fullscreen mode

In this run every row is a BMW, 17 sellers are professional and 3 private. previousPrice and hasNewTires are null on all 20 rows.


Pro tips

  1. Narrow by price first. With priceFrom and priceTo set, the run returns only the cars in that range.
  2. Use priceAsc for the cheapest listings. It puts the lowest prices first, so a small maxItems returns the cheapest cars of the search.
  3. Cap the run with both limits. maxItems stops the run at a row count and maxPages at a page count. Each page holds 20 listings.
  4. Turn on fetchSellers only when you need contacts. It is slower, and the four seller fields appear on rows whose dealer profile could be read.
  5. Check for missing values. A field can be null for one car and filled for another. This run had one row without a horsepower value, so test for None before you do arithmetic.
  6. Sort the output yourself. Save the rows and sort on price or mileageKm in your own code; the rows come back in the order the run chose, and sortBy decides that order.

Troubleshooting

  • FAILED with a list of makes. The make you typed is not on the site's list. The message names the closest makes; copy one of them.
  • FAILED saying no listing can match. priceFrom is above priceTo. Swap them or change one.
  • Refused before the run starts. The sortBy value is not newest or priceAsc.
  • SUCCEEDED with zero rows. The site answered and nothing matched. The status message says so. Widen the price range or drop the make.
  • FAILED with zero rows and a message about pages. Pages that could not be read ended the run with nothing saved. Run it again later.

A run that stored rows and then hit its time limit keeps those rows and logs a warning.


Next steps

For current pricing and details, see the Store page.

To repeat a search, save it as an Apify task and attach a schedule, which runs an Actor or task on a cron expression. Datasets export to several formats (dataset docs), and a webhook can notify your application when a run finishes.

Check that your use of the listing data complies with the site's terms and with data-protection law.

What will you search for on AutoScout24 Switzerland? Drop a comment! 💬

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

Top comments (0)