Skip to main content

kleinanzeigen

Async Python client for kleinanzeigen.de backed by plain HTTP (curl_cffi + BeautifulSoup) — no Playwright, no browser. Ships a CLI and an MCP server on top of the same client.

Requires Python 3.11+.

Based off the work done in ebay-kleinanzeigen-api and ported to run without a browser.

Note: this scrapes kleinanzeigen.de without a browser. Pages are fetched sequentially with delays to be polite - don't hammer it, and check kleinanzeigen.de's terms of service for your use case.

Install

# With uv
uv add kleinanzeigen

# With pip
pip install kleinanzeigen

# With pipx
pipx install kleinanzeigen

Library

import asyncio
from datetime import datetime

from kleinanzeigen import Kleinanzeigen, SearchParams


async def main():
    async with Kleinanzeigen() as ka:
        # keyword search; pages=0 fetches all pages
        result = await ka.search(
            SearchParams(query="fahrrad", location="Berlin", radius=25, pages=2)
        )
        for listing in result.listings:
            print(listing.title, listing.price, listing.url)
        print(result.total_results, result.total_pages, result.pages_fetched)

        # any saved/filtered search URL (page numbers injected automatically)
        result = await ka.search_url(
            "https://www.kleinanzeigen.de/s-suche/foo.html", pages=3
        )

        # drop listings older than a cutoff (naive = Europe/Berlin)
        result = await ka.search(
            SearchParams(query="fahrrad", published_after=datetime(2026, 1, 1))
        )

        # single ad, by URL or bare id — None when the ad is gone
        detail = await ka.get_listing("123456789")
        if detail:
            print(detail.title, detail.price.amount, detail.seller.name, detail.images)

        # streaming progress: yields (PageProgress, listings) per page
        async for progress, page_listings in ka.iter_search(
            SearchParams(query="fahrrad")
        ):
            print(progress.page, progress.total_pages, len(page_listings))


asyncio.run(main())

SearchParams fields: query, location, radius, min_price, max_price, page (first page, 1-based), pages (0 = all), published_after. iter_search_url(url, pages=n) is the streaming variant of search_url. iter_search_pages(url_for, first_page=, pages=) is the low-level primitive both streaming variants build on.

ListingDetail fields: ad_id, url, title, status (active/sold/ reserved/deleted), price (amount is None when the ad shows no numeric price, e.g. "VB" or "Zu verschenken"; negotiable flags "VB"), categories, description, location (postal_code/city/state), delivery (pickup/shipping), images, details, features, seller (name, user_id, member_since, type, badges), created_at, scraped_at.

CLI

Installed as kleinanzeigen:

# keyword search — all pages by default; Rich table with live spinner
kleinanzeigen search -q "fahrrad" -l "Berlin" --radius 5 --pages 3

# filters; --json prints raw JSON instead of the table
kleinanzeigen search -q "iphone" --min-price 100 --max-price 500 --json

# scrape a saved/filtered search URL
kleinanzeigen search-url "https://www.kleinanzeigen.de/s-suche/foo.html" --pages 3

# single ad by URL or bare id — prints JSON; exits 1 when the ad is gone
kleinanzeigen get 123456789

search options: -q/--query (required), -l/--location, --radius, --min-price, --max-price, --page, --pages, --published-after, --json. search-url accepts --pages, --published-after, --json.

MCP server

Installed as kleinanzeigen-mcp (stdio). Tools: search, search_url, get_listing. Search tools take the same arguments as the library plus a limit cap on returned listings; both accept published_after (ISO date/datetime). Responses are typed SearchResponse (listings, total_results, total_pages, pages_fetched, returned) or ListingDetail; a missing ad returns {"error": "listing not found or removed"}.

Add the following to your mcp json:

{
  "mcpServers": {
    "kleinanzeigen": {
      "command": "kleinanzeigen-mcp"
    }
  }
}

From a source checkout: uv run kleinanzeigen-mcp.

Notes

  • Pages are fetched sequentially with a delay (page_delay, default 1s; search_url enforces at least 2s) — Kleinanzeigen blocks concurrent requests from one IP.
  • published_after stops pagination early once older listings appear and trims them from results. Upstream timestamps are naive Europe/Berlin.
  • search/search_url return SearchResult (listings, total_results, total_pages, pages_fetched); get_listing returns ListingDetail or None.
  • Transient HTTP errors are retried (max_retries, exponential backoff); exhausted retries raise KleinanzeigenError.

Metadata

Release files for kleinanzeigen 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kleinanzeigen 0.1.0
File Size Uploaded Provenance Actions
kleinanzeigen-0.1.0.tar.gz 114.0 kB With provenance Details for kleinanzeigen-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kleinanzeigen 0.1.0
File Interpreter ABI Platform Actions
kleinanzeigen-0.1.0-py3-none-any.whl Python 3 none any Details for kleinanzeigen-0.1.0-py3-none-any.whl

Total release size: 134.3 kB

Release files / kleinanzeigen-0.1.0.tar.gz

Download URL kleinanzeigen-0.1.0.tar.gz
Size 114.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0d0ec0895bad7506fefd09da2ce73218abee02356fbd7dee8368d6604f42aeab
BLAKE2b-256 checksum
How to use checksums
b13659c0cfcc6aeaaa5afc5ccc3100de28277b12943cb4bcea486a64ec0ad7c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / kleinanzeigen-0.1.0-py3-none-any.whl

Download URL kleinanzeigen-0.1.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ff065b210fb46db2aceefd60155f92bfc5ef3e3eb5dea3950b615027b0ab583
BLAKE2b-256 checksum
How to use checksums
5d0ab405c2a412f9acfeba19cea04e418ab36f8eb1e43bd3b30faed6b7ee65aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for kleinanzeigen 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kleinanzeigen-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page