Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kleinanzeigen-Bot

Ein Python-basierter Bot, der automatisch auf neue Anzeigen auf kleinanzeigen.de reagiert ideal z.B. für heiß begehrte Artikel. Sobald eine passende Anzeige erscheint, wird automatisch eine Nachricht an den Anbieter gesendet.


Voraussetzungen

  • Python 3.11 (empfohlen)
  • chromedriver (installiert in deinem virtuellen Environment)
  • Ein Chrome-Profil mit aktivem Login bei Kleinanzeigen

Installation

  1. Repository klonen:

    git clone https://github.com/dein-user/kleinanzeigen-bot.git
    cd kleinanzeigen-bot
  2. Virtuelle Umgebung erstellen:

    python3.11 -m venv venv
    source venv/bin/activate
  3. Abhngigkeiten installieren:

    pip install -r requirements.txt

Chromedriver (nur lokal in der venv nutzen)

  1. Version prüfen:
    Öffne Chrome und rufe chrome://settings/help auf – notiere dir die Version.

  2. Passenden Chromedriver herunterladen:
    https://chromedriver.chromium.org/downloads

  3. Entpacken und lokal speichern:

    unzip chromedriver_mac64.zip
    mv chromedriver ./venv/bin/
    chmod +x ./venv/bin/chromedriver

Konfiguration

Erstelle eine Datei .env im Projektverzeichnis (Beispiel: siehe .env.example):

EMAIL=dein@mail.de
PASSWORD=deinpasswort
MESSAGE_TEXT=Hi, ich habe Interesse! :)
CHROME_PROFILE_PATH=/Users/deinname/path/zum/chrome-profile
SEARCH_URL=https://www.kleinanzeigen.de/s-bender-statue/k0
BLACKLIST=fake,broken

Chrome-Profil vorbereiten

Falls du dein aktives Chrome-Profil nur fr den Bot verwenden mchtest, gehe so vor:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --user-data-dir="/tmp/kleinanzeigen-profile" \
  --profile-directory=Default
  1. Melde dich im geffneten Chrome bei Kleinanzeigen an.

  2. Schliee Chrome.

  3. Kopiere das Profil in dein Projektverzeichnis:

    cp -R /tmp/kleinanzeigen-profile ./chrome-profile
  4. Trage den Pfad in deiner .env ein:

    CHROME_PROFILE_PATH=/Users/deinname/deinprojektverzeichnis/chrome-profile

Nutzung

1. API starten

python api.py

2. Scraper starten (durchsucht regelmig die Anzeigen):

python scraper.py

Wenn eine passende Anzeige erscheint, wird:

  • berprft, ob sie bereits bekannt ist
  • auf Blacklist gefiltert
  • und automatisch messenger.py mit der Anzeigen-URL aufgerufen

Optional Headless-Modus

  • Wenn du den Bot im unsichtbaren Headless-Modus nutzen möchtest, kannst du in messenger.py in der Funktion setup_driver() die Zeile

    options.headless = False

    durch

    options.add_argument("--headless=new")

    ersetzen.


Projektstruktur

kleinanzeigen-bot/

 api.py               # Flask-Server fr Kommunikation
 scraper.py           # Sucht regelmig nach neuen Anzeigen
 messenger.py         # Sendet Nachricht ber Chrome
 .env                 # Konfiguration (nicht in Git!)
 .env.example         # Beispielkonfiguration
 requirements.txt     # Python-Abhngigkeiten
 seen_ads.txt         # Bereits gesichtete Anzeigen
 ignored_ads.txt      # Anzeigen, die durch Blacklist gefiltert wurden
 chrome-profile/      # Gespeichertes Chrome-Profil mit Login
 README.md

Hinweise

  • Verwende den Bot verantwortungsvoll.
  • Kleinanzeigen.de kann automatisierten Zugriff ggf. blockieren nutze Pausenintervalle und keine zu aggressive Frequenz.
  • Projekt dient als Lern- und Automatisierungshilfe, keine Garantie auf Erfolg oder dauerhafte Funktionalitt.

To Do (optional)

  • Benutzer-Login über Eingabe statt .env
  • Mehrfach-Absendeschutz
  • Frontend-UI zur Verwaltung
  • Erweiterte blacklist/ignore Logik

Kontakt

Georg | github.com/patchwork-lab




ENGLISH README VERSION

Classified Ads Bot

A Python-based bot that automatically responds to new listings on kleinanzeigen.de – ideal for highly sought-after tickets. As soon as a suitable listing appears, a message is automatically sent to the seller.


Requirements

  • Python 3.11 (recommended)
  • chromedriver (installed in your virtual environment)
  • A Chrome profile with an active login on Kleinanzeigen

Installation

  1. Clone the repository:

    git clone https://github.com/dein-user/kleinanzeigen-bot.git
    cd kleinanzeigen-bot
  2. Create a virtual environment:

    python3.11 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

Chromedriver (local use inside venv only)

  1. Check your Chrome version:
    Open Chrome and go to chrome://settings/help – note the exact version.

  2. Download the matching Chromedriver:
    https://chromedriver.chromium.org/downloads

  3. Unzip and place inside your venv:

    unzip chromedriver_mac64.zip
    mv chromedriver ./venv/bin/
    chmod +x ./venv/bin/chromedriver

Configuration

Create a .env file in the project directory (example: see .env.example):

EMAIL=your@mail.com
PASSWORD=yourpassword
MESSAGE_TEXT=Hi, I'm interested! :)
CHROME_PROFILE_PATH=/Users/yourname/path/to/chrome-profile
SEARCH_URL=https://www.kleinanzeigen.de/s-bender-statue/k0
BLACKLIST=fake,broken

Preparing the Chrome Profile

If you want to use your active Chrome profile only for the bot, proceed as follows:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
  --user-data-dir="/tmp/kleinanzeigen-profile" \
  --profile-directory=Default
  1. Log in to Kleinanzeigen in the opened Chrome window.

  2. Close Chrome.

  3. Copy the profile to your project directory:

    cp -R /tmp/kleinanzeigen-profile ./chrome-profile
  4. Enter the path in your .env file:

    CHROME_PROFILE_PATH=/Users/yourname/yourprojectdirectory/chrome-profile

Usage

1. Start API

python api.py

2. Start Scraper (regularly searches listings):

python scraper.py

When a suitable listing appears, the bot:

  • Checks whether it's already known
  • Filters based on blacklist
  • and automatically calls messenger.py with the listing URL

Optional Headless-Mode

  • If you want to use the bot in invisible headless mode, open messenger.py and change this line in the setup_driver() function:

    options.headless = False

    to

    options.add_argument("--headless=new")

Project Structure

kleinanzeigen-bot/

 api.py               # Flask server for communication
 scraper.py           # Regularly searches for new listings
 messenger.py         # Sends message via Chrome
 .env                 # Configuration (not in Git!)
 .env.example         # Example configuration
 requirements.txt     # Python dependencies
 seen_ads.txt         # Already seen listings
 ignored_ads.txt      # Listings filtered by blacklist
 chrome-profile/      # Saved Chrome profile with login
 README.md

Notes

  • Use the bot responsibly.
  • Kleinanzeigen.de may block automated access – use pause intervals and avoid aggressive frequency.
  • This project is intended as a learning and automation aid, no guarantee of success or permanent functionality.

To Do (optional)

  • User login via input instead of .env
  • Multiple send protection
  • Frontend UI for management
  • Extended blacklist/ignore logic

Contact

Georg | github.com/patchwork-lab

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages