Last active
February 16, 2023 17:59
-
-
Save Staubgeborener/99cd3ce67a14ce3139a225628f41149d to your computer and use it in GitHub Desktop.
ebayKleinanzeigen_WohnungsBot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add cronjob to run this every x minutes/hours/days | |
#initialize files | |
touch wohnung_id.txt | |
touch wohnung_id_old.txt | |
TELEGRAM_BOT_TOKEN=xxxxx | |
TELEGRAM_CHAT_ID=xxxxx | |
#ORT= | |
ORTSTEIL= | |
EBAY_ORT_ID=xxxxx | |
ZIMMER_MIN=1 | |
ZIMMER_MAX=1 | |
PREIS_MIN=0 | |
PREIS_MAX=9999 | |
ETAGE_MIN=1 | |
ETAGE_MAX=99 | |
echo $TELEGRAM_BOT_TOKEN | |
#download everything now, grepping later | |
wget https://www.ebay-kleinanzeigen.de/s-wohnung-mieten/$ORTSTEIL/preis:"$PREIS_MIN":"$PREIS_MAX"/wohnung/$EBAY_ORT_ID+wohnung_mieten.etage_i:"$ETAGE_MIN"%2C"$ETAGE_MAX"+wohnung_mieten.zimmer_d:"$ZIMMER_MIN"%2C"$ZIMMER_MAX" -O output.txt | |
grep "data-href" output.txt | cut -c 52- > wohnung_id.txt | |
FILE1=wohnung_id.txt | |
FILE2=wohnung_id_old.txt | |
if cmp --silent -- "$FILE1" "$FILE2"; then | |
echo "Dateien identisch, keine neue Wohnung" | |
else | |
echo "Neue Wohnung!" | |
cp $FILE1 $FILE2 | |
EBAY_LINK="https://www.ebay-kleinanzeigen.de/s-anzeige/"$(grep -m1 "" wohnung_id.txt) | |
curl -s -X POST https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage -d chat_id=$TELEGRAM_CHAT_ID -d text="$EBAY_LINK" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment