Skip to content

Bot that helps you find a flat/room by sending messages to new listings

Notifications You must be signed in to change notification settings

ad0409/wg-gesucht-bot

This branch is 7 commits ahead of jonasdieker/wg-gesucht-bot:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e6640a5 · Mar 15, 2025

History

97 Commits
Feb 11, 2025
Feb 15, 2025
Feb 9, 2025
Feb 15, 2025
Feb 9, 2025
Jan 12, 2024
Mar 15, 2025
Feb 15, 2025

Repository files navigation

WG-Gesucht Bot

Let's face it, looking for a new WG is a pain, so why not just automate the process?

Note on GPT use:

Option to use OpenAI GPT model to create more personalised messages!

So far only language classification and keyword detection are supported.

You can easily add more functionality. Simply process the listing text (config['listing_text']) with GPT by writing a function which uses the OpenAIHelper class. Look at the gpt_get_language function inside the src/submit_wg.py file to get an idea.

Getting Started

1 Create virtual environment and install Python packages

python -m venv env
source env/bin/activate
pip install -r requirements.txt
playwright install

2 Ensure chromedriver and google-chrome are installed

google-chrome --version
chromedriver --version

Both should provide an output. If not:

google-chrome

In case google-chrome is missing, run

wget -O google-chrome.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
sudo apt install ./google-chrome.deb -y

chromedriver

In case chromedriver is missing, find the latest available cross-platform Chrome for Testing here. Download the linux folder, unpack it and copy the chromedriverfile to /usr/bin.

Ensure that chromdriver can get executed with

sudo chmod +x /usr/bin/chromedriver

Running which chromedriver should now return a path /usr/bin/chromedriver.

More info: https://chromedriver.chromium.org/downloads

Note: Ensure that your Chrome version matches the chromedriver version.

3 Setup config file

Rename config_template.yaml to config.yaml, enter your email and password for wg-gesucht.de and your token for OpenAI (optional).

messages:
  german: "message_de.txt" # add this file
  english: "message_en.txt" # add this file
wg_gesucht_credentials:
  email: "my-email@email.com" # change
  password: "password1234" # change
chromedriver_path: "/usr/bin/chromedriver" # change!
url: "" # change!
openai_credentials:
  api_key: ""
run_headless: false
min_listing_length_months: 6
rental_start:
  year: 2024
  month: 3
  day: 1
  buffer_days: 14

If you wish to send messages in e.g. english ONLY, simply delete german: "message_de.txt from the messages list in config.yaml file.

If no OpenAI token is provided, the bot will simply pick the first element from the messages list.

You also need to enter the url. Just go to wg-gesucht.de, enter all your filter requirements, apply filter and simply copy the url you get.

4 Write message into message_de.txt and message_en.txt

Make sure you use the format of Hello recipient. Since the code automatically replaces recipient with the name of the user.

5 Finally, simply run:

bash run.sh

To change configs edit the config.yaml file.

Acknowledgements

Thanks to the code by nickirk, which served as a starting point for this project.

Note: Most of the code has been completely rewritten for simplicity and speed improvements.

About

Bot that helps you find a flat/room by sending messages to new listings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.5%
  • Dockerfile 4.2%
  • Shell 0.3%