Skip to main content

Scrapes rental properties listed on www.immoscout24.de

Project description

immoscout-scraper

Release Build status License

Scrapes rental properties listed on <www.immoscout24.de>

Installation

Using uv (recommended)

git clone https://github.com/libklein/immoscout-scraper.git
cd immoscout-scraper
uv sync

Using pip

pip install immoscout-scraper

Usage

Command Line Interface

The scraper provides a command-line interface with support for arguments and environment variables.

Basic Usage

# Using uv
uv run immoscout-scraper "https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten"

# If installed via pip
immoscout-scraper "https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten"

With Options

immoscout-scraper \
  "https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten" \
  --output-path ./my-properties.db \
  --max-requests-per-second 10 \
  --max-pages 5

For a list of supported options, run:

immoscout-scraper --help

Environment Variables

All CLI arguments can be configured using environment variables with the IMMOSCOUT_SCRAPER_ prefix:

Environment Variable CLI Argument Default Description
IMMOSCOUT_SCRAPER_SEARCH_URL search_url required ImmoScout24 search URL to scrape
IMMOSCOUT_SCRAPER_OUTPUT_PATH --output-path properties.db Path to SQLite database file
IMMOSCOUT_SCRAPER_MAX_REQUESTS_PER_SECOND --max-requests-per-second 16 Rate limit for API requests
IMMOSCOUT_SCRAPER_MAX_PAGES --max-pages unlimited Maximum number of pages to scrape
IMMOSCOUT_SCRAPER_CHUNKSIZE --chunksize 100 Save eagerly after scraping this many properties
IMMOSCOUT_SCRAPER_RESCRAPE --rescrape false Ignore previously scraped properties and scrape all properties again

Docker Usage

docker run --rm \
  -v $(pwd)/data:/out \
  libklein/immoscout-scraper \
  "https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten"

Using Environment Variables

docker run --rm \
  -v $(pwd)/data:/out \
  -e IMMOSCOUT_SCRAPER_SEARCH_URL="https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten" \
  -e IMMOSCOUT_SCRAPER_MAX_PAGES="20" \
  libklein/immoscout-scraper

Docker Compose Example

version: '3.8'
services:
  scraper:
    image: libklein/immoscout-scraper
    environment:
      - IMMOSCOUT_SCRAPER_SEARCH_URL=https://www.immobilienscout24.de/Suche/de/berlin/berlin/wohnung-mieten
      - IMMOSCOUT_SCRAPER_MAX_REQUESTS_PER_SECOND=16
      - IMMOSCOUT_SCRAPER_MAX_PAGES=20
    volumes:
      - ./data:/out

Docker Environment Variables

The Docker container comes with the following pre-configured environment variables:

  • IMMOSCOUT_SCRAPER_OUTPUT_PATH=/out/properties.db - Saves database to mounted volume
  • IMMOSCOUT_SCRAPER_MAX_REQUESTS_PER_SECOND=16 - Conservative rate limiting

Development

Setting Up Development Environment

  1. Clone the repository:
git clone https://github.com/libklein/immoscout-scraper.git
cd immoscout-scraper
  1. Install dependencies and pre-commit hooks:
make install
  1. Run pre-commit hooks:
uv run pre-commit run -a

Running Tests

uv run pytest

Code Formatting

uv run ruff format
uv run ruff check --fix

URL Requirements

  • The scraper only accepts URLs from www.immobilienscout24.de domain
  • URLs from api.mobile.immobilienscout24.de are not accepted (these are converted automatically)
  • Search URLs should be in the format: https://www.immobilienscout24.de/Suche/de/...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

immoscout_scraper-1.2.0.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

immoscout_scraper-1.2.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file immoscout_scraper-1.2.0.tar.gz.

File metadata

  • Download URL: immoscout_scraper-1.2.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for immoscout_scraper-1.2.0.tar.gz
Algorithm Hash digest
SHA256 185fc878985b1a645c5a4e7727782d47274a9d7e01aeb17a22dc223594a9dea1
MD5 dfd003d22a516c08c5dc4abb605dd2a8
BLAKE2b-256 30ece5e68ddb66f2a40bfd5c1e98cacae92a49a75efc1e4fca3d07f03ca7915a

See more details on using hashes here.

File details

Details for the file immoscout_scraper-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for immoscout_scraper-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b084e291e71fc0e93b2e2dcfa1c0722963667d5983b7b129a4f369a6ad56a73
MD5 418ec6be7dc8b327513ffacc713ff60f
BLAKE2b-256 c9c73d340ea331343a1af0b3ce4085507e4a5a2a6b6ce967389390a368392ae6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page