A simple crawler and notifier of divar.ir advertisements, based on pre-defined conditions.
This telegram bot notifies you whenever a new ad appears in the specified topic on Divar, an Iranian Persian classified ads and E-commerce app.
-
Open
@BotFather
in Telegram, create a new bot, and note its token (Or use an existing bot token) to use in the.env
file later. -
Send a message to
@getidsbot
and the response should be something like this:👤 You ├ id: 00000000 ├ is_bot: false ├ first_name: Ehsan ├ last_name: Seyedi ├ username: _ (https://t.me/_) ├ language_code: en (-) └ created: ~ 2/2014 (?) (https://t.me/getidsbot?start=idhelp)
Note the
id
to use in the.env
file later. -
Open your bot (from step 1) and press Start (So the bot can send messages to your account chat).
-
Visit the Divar, select your city, and go to the desired category. Choose some search conditions like this:
The web browser's URL should be something like this:
https://divar.ir/s/tehran/rent-residential/abshar?size=65-120
Note everything after
https://divar.ir/s/
, in this case, it will betehran/rent-residential/abshar?size=65-120
, to use in the.env
file later like this:SEARCH_CONDITIONS = "tehran/rent-residential/abshar?size=65-120"
git clone https://github.com/debMan/divar-telegram-bot.git
cd divar-telegram-bot
cp .env.sample .env
# edit .env file with datas from Pre-requisites step
editor .env
echo '[]' > tokens.json
pip install -r requirements.txt
./main.py
git clone https://github.com/debMan/divar-telegram-bot.git
cd divar-telegram-bot
cp .env.sample .env
# edit .env file with datas from Pre-requisites step
editor .env
echo '[]' > tokens.json
docker compose up -d
To run the crawler in development mode, simply follow the Local or Docker instructions with an uncommented build: .
line in the docker-compose.yml
file, then:
docker compose up --build