Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ehcaning/divar-telegram-bot
این ربات تلگرام هر موقعی که توی تاپیک مورد نظرتون آگهی جدیدی بیاد، بهتون توی تلگرام اطلاع میده
https://github.com/ehcaning/divar-telegram-bot
bot divar telegram telegram-bot
Last synced: 4 days ago
JSON representation
این ربات تلگرام هر موقعی که توی تاپیک مورد نظرتون آگهی جدیدی بیاد، بهتون توی تلگرام اطلاع میده
- Host: GitHub
- URL: https://github.com/ehcaning/divar-telegram-bot
- Owner: ehcaning
- Created: 2021-08-02T08:13:37.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-01T06:21:00.000Z (over 1 year ago)
- Last Synced: 2023-08-02T13:54:52.098Z (over 1 year ago)
- Topics: bot, divar, telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 126 KB
- Stars: 68
- Watchers: 3
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Divar Telegram Bot
1- Open `@BotFather` in Telegram.
2- Create a new bot and copy bot token. (Or use existing bot and copy bot token)
```python
BOT_TOKEN = ''
```
3- Send a message to `@getidsbot` and response should be something like this:
```text
👤 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)
```
Copy `id` and paste here:
```python
BOT_CHATID = ''
```4- Open your new (or old) bot (from step 2) and press `Start` (So bot can send you messages).
5- Go to https://divar.ir/, select your city and go to desired category. Choose some search conditions like this:
![Divar Search](img/search.png)
Web browser's URL should be something like this:
```url
https://divar.ir/s/mashhad/rent-residential/janbaz?districts=1124%2C442&credit=-100000000&rent=-3000000&size=-90
```
Copy everything after `https://divar.ir/s/`, in this case it will be `mashhad/rent-residential/janbaz?districts=1124%2C442&credit=-100000000&rent=-3000000&size=-90`And paste this here:
```python
URL = "https://api.divar.ir/v8/web-search/"
```6- SSH to your server and make a cronjob to execute this code in which frequency you want.
```bash
crontab -e
``````crontab
*/2 * * * * cd /root/divar_bot; /usr/bin/python3.8 main.py >> /dev/null 2>&1
```
* In this example, repository is in `/root/divar_bot` directory
* This code will run every 2 minutes, if you need any help visit https://crontab.guru/## Final Result:
![Telegram Messages](img/preview.png)