Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Scrape Kleinanzeigen in Node.js

This example shows how to scrape listings from Kleinanzeigen — Germany's largest classifieds platform — using the Kleinanzeigen Listings Scraper actor on Apify. No browser automation or HTML parsing required: just call the actor via the Apify API client and get structured data back.

Kleinanzeigen scraper results

What this example does

  • Calls the Kleinanzeigen Listings Scraper actor with a category URL and search terms
  • Waits for the run to complete
  • Fetches results from the actor's output dataset
  • Prints each listing to the console

Prerequisites

Installation

npm install

Environment setup

cp .env.example .env

Open .env and replace your_apify_token_here with your actual Apify API token.

Usage

npm start

Code example

import { ApifyClient } from 'apify-client';
import 'dotenv/config';

// Initialize the ApifyClient with your Apify API token
// Set APIFY_TOKEN in your .env file (copy .env.example to get started)
const client = new ApifyClient({
    token: process.env.APIFY_TOKEN,
});

// Prepare Actor input
const input = {
    "startUrls": [
        {
            "url": "https://www.kleinanzeigen.de/s-elektronik/"
        }
    ],
    "searchTerms": [
        "iphone 13",
        "laptop"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/kleinanzeigen-listings-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

Example output

See sample-output.json for a full example. The actor returns results in two modes:

Listing mode — fast, page-level data:

Field Description
adId Unique ad identifier
url Direct link to the listing
title Ad title
price Price string (e.g. "900 € VB")
location City and postal code
datePosted Posting date or relative time
description Short description snippet
shipping Available shipping options
isPro Whether the seller is a professional
imageCount Number of images attached
scrapedAt ISO timestamp of when the item was scraped

Detail mode — richer data fetched from individual listing pages:

Field Description
sellerName Name of the seller
category Breadcrumb category path
attributes Structured key/value attributes (brand, condition, color, etc.)
images Array of full-resolution image URLs

Use cases

  • Price monitoring — track used electronics or car prices over time
  • Market research — analyze supply/demand for specific product categories in Germany
  • Competitor analysis — monitor listings from professional sellers in your niche
  • Lead generation — find sellers of specific items for resale or sourcing
  • Academic research — study pricing patterns, regional trends, or listing behavior on German classifieds

Try the actor on Apify

Open the Kleinanzeigen Listings Scraper on Apify

Related resources

License

MIT

About

Example showing how to scrape Kleinanzeigen listings in Node.js using the Apify Kleinanzeigen Listings Scraper actor

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages