Skip to content

DanielWTE/ebay-kleinanzeigen-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ebay Kleinanzeigen API

Ebay Kleinanzeigen API

A powerful API interface for Ebay-Kleinanzeigen.de that enables you to fetch listings and specific data.

πŸš€ Looking for a ready-to-use solution?
Try it at kleinanzeigen-agent.de Β»
βœ“ Automated Search Agents
βœ“ Search & Detail API
Report Bug Β· Request Feature

(back to top)

Getting Started

Want to skip the setup?

Visit kleinanzeigen-agent.de for our hosted solution with additional features and zero configuration required.

Prerequisites

  • Python 3.12 or higher
  • pip (Python package manager)
  • Playwright

Installation

  1. Clone the repository
git clone https://github.com/DanielWTE/ebay-kleinanzeigen-api.git
cd ebay-kleinanzeigen-api
  1. Install dependencies
pip install -r requirements.txt
playwright install chromium
  1. Start the API
uvicorn main:app --reload

The API will be available at http://localhost:8000

Installation using UV

Prerequisites

  • uv package manager

Installation of dependencies

uv sync

Start the API

uv run uvicorn main:app --reload

Installation using Docker

  1. Build the Docker image
docker build -t ebay-kleinanzeigen-api .
  1. Run the Docker container
docker run -p 8000:8000 ebay-kleinanzeigen-api

The API will be available at http://localhost:8000

API Endpoints

1. Fetch Listings (Standard)

Endpoint: GET /inserate

Description: Retrieves a list of listings based on search criteria.

Query Parameters
  • query (string, optional): The search term (e.g., "fahrrad" to search for bicycles).
  • location (string, optional): The location or postal code to narrow the search (e.g., 10178 for Berlin).
  • radius (integer, optional): The search radius in kilometers from the specified location (e.g., 5 for a 5 km radius).
  • min_price (integer, optional): The minimum price in Euros for the listings (e.g., 200 for at least 200 Euros).
  • max_price (integer, optional): The maximum price in Euros for the listings (e.g., 500 for at most 500 Euros).
  • page_count (integer, optional): The number of pages to search or return (e.g., 5 for the first 5 pages, default is 1, max: 20 pages).
Example Request
GET /inserate?query=fahrrad&location=10178&radius=5&min_price=200&page_count=5

2. Fetch Listing Details

Endpoint: GET /inserat/{id}

Description: Retrieves detailed information about a specific listing.

Path Parameters
  • id (string): The unique identifier of the listing to fetch details for.
Example Request
GET /inserat/12345

3. Fetch Listings with Details (Combined)

Endpoint: GET /inserate-detailed

Description: Retrieves listings and their detailed information in a single request.

Query Parameters

Same as /inserate endpoint, plus:

  • max_concurrent_details (integer, optional): Maximum concurrent detail fetches (default: 5, max: 10).
Example Request
GET /inserate-detailed?query=laptop&page_count=2&max_concurrent_details=5

Documentation

API Response Format

All API endpoints return responses in the following JSON format:

API Response Format
{
  "success": true,
  "time_taken": 1.23,
  "unique_results": 100,
  "data": [...],
  "performance_metrics": {
    "pages_requested": 5,
    "pages_successful": 5,
    "success_rate": 100.0,
    "average_page_time": 2.45
  }
}
Combined Endpoint Response Format
{
  "success": true,
  "time_taken": 3.45,
  "unique_results": 25,
  "data": [
    {
      "adid": "123456",
      "title": "Example Item",
      "price": "100",
      "details": {
        "id": "123456",
        "description": "Full description...",
        "seller": {...},
        "location": {...}
      }
    }
  ],
  "performance_metrics": {
    "listings_found": 25,
    "details_fetched": 25,
    "success_rate": 100.0
  }
}

Performance Features

πŸ“Š Performance Benchmarks

Performance tests conducted on Arch Linux with Intel i7-1260P processor:

Endpoint Operation Avg Time Min Time Max Time Success Rate Results
Root API status check 0.004s 0.001s 0.009s 100% -
Listings 1 page search 1.209s 1.081s 1.596s 100% 25
Listings 5 pages search 2.436s 2.328s 2.532s 100% 125
Listings 10 pages search 4.989s 4.790s 5.229s 100% 250
Details Single listing details 1.072s 0.928s 1.276s 100% 1
Combined 1 page + details 9.058s 8.804s 9.319s 100% 25
Combined 2 pages + details 17.512s 17.063s 18.038s 100% 50

Performance Highlights

  • Single page search: ~1.2s average response time
  • 10-page search: ~5.0s average response time
  • Individual listing details: ~1.1s average response time
  • Combined search + details: ~9.1s average for 1 page with full details

All tests performed with uvloop optimization and browser context pooling enabled.

πŸš€ Technical Features

  • uvloop Integration: High-performance asyncio event loop
  • Context Pooling: Efficient browser resource reuse
  • Memory Optimization: Automatic garbage collection and efficient processing
  • Intelligent Concurrency: Optimal concurrent processing with resource control

πŸ”§ Production Ready

  • Clean API Responses: Minimal overhead with essential data only
  • Resource Management: Automatic cleanup and efficient resource usage
  • Scalable Architecture: Handles concurrent requests efficiently
  • Docker Optimized: Fast container builds with uv package manager

API documentation is available at http://localhost:8000/docs when running locally.

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

This tool acts as an API interface, you can use it to get random listings from Ebay-Kleinanzeigen.de, exact data from specific listings and even views of listings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors