Let's face it, looking for a new WG is a pain, so why not just automate the process?
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.
python -m venv env
source env/bin/activate
pip install -r requirements.txt
playwright install
google-chrome --version
chromedriver --version
Both should provide an output. If not:
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
In case chromedriver
is missing, find the latest available cross-platform Chrome for Testing here. Download the linux folder, unpack it and copy the chromedriver
file 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.
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.
Make sure you use the format of Hello recipient
. Since the code automatically replaces recipient
with the name of the user.
bash run.sh
To change configs edit the config.yaml
file.
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.