Do you ever buy something, only to find later that you had a discount for it?
This Python project is a Telegram bot that scrapes various sources for discounts and provides them to users on command.
The project consists of two main components:
- A discount updater script (
main_discount_updater.py
) - The Telegram bot itself (
main_telegram_bot.py
)
- Clone the repository
- Install the required dependencies
pip install -r requirements.txt
- Setup your telegram bot with the Bot Father
- Copy
bot_template.yaml
tobot.yaml
and modify theTOKEN
andCHAT_ID
values inbot.yaml
- If something goes wrong while collecting the discount from the sources, a message will be sent to that chat.
- If you don't want to be notified, simply remove
CHAT_ID
frombot.yaml
- If you're on Linux, install the ChromeDriver driver with
sudo apt install chromium-chromedriver
Run the discount updater script to scrape discount information from the sources and generate a file with the results.
python main_discount_updater.py
You can set up a cronjob to run this script at regular intervals to keep the discount information up-to-date.
Run the Telegram bot to provide users with discount information fetched from the generated file.
python main_telegram_bot.py
The bot responds to the following commands:
/search
: Search for specific discounts
/all
: Retrieve all available discounts
![](https://private-user-images.githubusercontent.com/8866496/290230015-834dd1e3-a0fe-449b-9c9b-e2a6050dfc99.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0ODIzMTgsIm5iZiI6MTczOTQ4MjAxOCwicGF0aCI6Ii84ODY2NDk2LzI5MDIzMDAxNS04MzRkZDFlMy1hMGZlLTQ0OWItOWM5Yi1lMmE2MDUwZGZjOTkuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMjEyNjU4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWNhN2U3MTg2MzkwNjEwOTA2YmEzNTAxYzBkNDg3MDdhZjhmNjBmMzJhYmQxMzllOTUwNTgwNzE3MTQyMjM4MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.RIlb1aXZGlDy_O4MYmq11p5MmEW0FiNKtFI1cEYFIds)
Feel free to contribute to the project by adding other sources of discount information.