Skip to content

Scraping Immoscout24.ch Property Data in Python: Embedded JSON, Anti-Bot Handling and Swiss Data Rules

Immoscout24.ch is a Swiss property portal whose listings are delivered through JavaScript-rendered pages and structured data embedded in the response. This guide explains where that data lives, how to retrieve a rendered search page, how to validate the response before parsing, and which fields to leave out. It also covers the contractual and data-protection limits that apply before any code runs.

First, confirm which portal you are targeting

Confirm the target before reusing any example code. The Swiss portal is operated by SMG Swiss Marketplace Group, while the similarly named German portal is run by a different company. Their domains, page flows, endpoints and protections differ, so German-site snippets are not a reliable starting point.

A useful pre-flight checklist:

  • Verify the domain in the URL is the Swiss one.
  • Check the platform terms and robots.txt before requesting pages.
  • Decide which property fields you need and exclude contact fields by default.
  • For bulk or commercial use, pursue the official partner data feed instead of page collection.

Where the listing data is stored

The portal is JavaScript-rendered, so listing data may not appear as ordinary HTML elements. Two cleaner routes exist: a JSON state object embedded in a script element, and an internal JSON API called in the background. Inspecting the page source reveals the embedded state, while the browser network panel filtered to Fetch/XHR reveals background calls.

Structured JSON is preferable to CSS selectors because it is less tied to visual redesigns, although the JSON shape can still change. On a detail page, do not assume the search-results path applies; inspect the returned structure and adjust the extraction path accordingly.

Retrieving and parsing a search page

The workflow uses a rendered request with JavaScript enabled, resources allowed to load, anti-bot proxy handling and a Swiss country route. The setup modules code0001 to code0005 cover the project folder, virtual environment and library installation, and module code0006 shows the initial rendered request.

A 200 status and a large body are only initial signals. Before parsing, check for expected listing content and fail clearly if you receive a verification page, a challenge page or an empty application shell. If a later run returns an error, the guidance in the captured material suggests allowing resources and waiting for network idle, as noted alongside module code0006.

For extraction, module code0008 locates the embedded state object, decodes it and walks to the listings. The captured example in module code0009 returned 20 listings for the Baden rental search, including identifiers, gross rent, room count, living space, locality, postcode, street and a listing link. That example is useful as a field map: it shows which attributes can be produced without touching contact fields.

Why a detail page may fail

A detail page can fail even when a search page succeeds. In the captured test, the detail request returned HTTP 500 with a short body, as recorded in module code0011, so no property data could be extracted from that response. Even a 200 response needs validation, because a challenge page can also return that status.

Treat status, body size and content checks as separate gates: reject non-success responses, reject pages without the expected embedded state, and only then parse fields. This prevents a block page from being mistaken for an empty result set.

Structured extraction as an alternative

Module code0012 shows an alternative that asks for named fields in plain language and returns structured JSON. Its output shape is not guaranteed: it may be a bare array or a wrapped object, so the code normalises both forms into a list and uses null for missing values. If a wrapped response contains several list fields, target the expected key explicitly rather than taking the first list found. The captured material notes an additional credit cost for this option.

Use the known JSON path when it is stable and verified; use the field-description approach when the page structure is less predictable, and validate the returned field names either way.

Paginating without overwhelming the site

Pagination should be deliberately limited. The captured example requests only the first two pages, waits three seconds between requests, and writes combined attributes to CSV; module code0014 records 20 listings from each page and 40 in total. Module code0015 adds bounded retries, per-record error handling and skipping of malformed entries while keeping the same CSV fields.

A responsible pagination checklist:

  • Cap the number of pages before the run starts.
  • Delay between requests, not before the first one.
  • Retry only a bounded number of times.
  • Skip a failed page or record with a clear message instead of writing partial rows silently.
  • Stop if requests begin to disrupt the service.

Why simple workarounds fall short

Challenges can appear on the first request rather than after heavy use. User-agent rotation does not address behavioural fingerprinting or TLS signals. Delays alone do not remove the trigger, stealth plugins do not cover every JavaScript-environment and network signal, and free proxy lists are often already flagged.

The practical combination is anti-bot handling plus a Swiss exit IP, with low request volume. Prefer structured endpoints where possible to reduce full page renders.

Terms and Swiss data-protection limits

Publicly visible property attributes are not automatically unlawful to collect, but the platform terms prohibit systematic selection, copying, publishing or linking of content, creating contractual and civil risk regardless of volume. That is distinct from an automatic criminal offence.

For data protection, Switzerland's revised Federal Act on Data Protection applies to personal data about people in Switzerland, including agent names, direct phone numbers, email addresses and precise geolocation in listings. Public availability is not consent to harvest, store or redistribute that data. GDPR may also apply for EU-based processing, but it should not replace the Swiss analysis for a Swiss platform. Descriptions, images and precise addresses also need review because they can reveal identifying information.

Collect property attributes such as price, rooms, floor area, features, construction year and energy label. Minimise or skip names, direct phone numbers, email addresses and identifiable photos, and do not build a contact database from listings. For commercial-scale needs, the partner data feed is the appropriate channel. This is general information, not legal advice.

Frequently asked questions

Is it legal to scrape Immoscout24.ch?

Public property attributes are not automatically unlawful to view, but systematic collection conflicts with the platform terms, creating contractual and civil risk. Agent names, phone numbers, emails and similar contact details are personal data under Switzerland's revFADP and, where applicable, GDPR; public visibility is not consent to harvest or store them. This summary is not legal advice.

Does Immoscout24.ch have an API?

There is no open public API for arbitrary listing data. Access for bulk or commercial needs is gated through the operator's partner portal and partner data feed.

Why does my scraper get a CAPTCHA on the first request?

The site fingerprints requests and challenges automated traffic immediately, with non-Swiss traffic especially likely to be challenged. Changing a user-agent, adding delays, using stealth plugins or free proxy lists alone does not address the network and browser signals being checked.

Is Immoscout24.ch the same as ImmobilienScout24.de?

No. The Swiss portal and the German portal are separate companies with separate infrastructure, terms and protections. Code, endpoints and parameters written for the German site should not be assumed to work on the Swiss site.

Can I collect agent contact details from listings?

Treat them as personal data. Names, direct phone numbers, email addresses and identifiable photos require care under revFADP and GDPR, and building a contact database from listings carries enforcement risk. A responsible approach collects property attributes and minimises or skips contact fields.

How do I not get blocked scraping Immoscout24.ch?

Combine anti-bot handling with a Swiss exit IP, keep request volume low, add polite delays between requests, and prefer structured JSON where possible instead of repeatedly rendering full pages.