- Notifications
You must be signed in to change notification settings - Fork1
Python script to monitor a product and send notification on telegram on price drop.
License
jadia/amazon-price-notify
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Python application to monitor an Amazon.in product and send notification through telegram on price drop.
The application has two parts:
- Monitor price
- Send notification
Monitor price:
Requests and Beautifulsoup modules are used to scrape the page and get the product title and it's price. The product page is scrapped every 15 min.
Send notification:
Generate a price drop alert to user via Telegram API usingpython-telegram-bot
module.
Install dependencies (debian/ubuntu):
sudo apt-get -y install python3-pip&& \sudo pip3 install -r requirements.txt
The script was tested on Python 3.7.3.
Refer official telegram documentaion onHow to create a new bot
Put thebotToken
generated from @botFather inconfig.json
and runmain.py
.
python3 ./main.py
botToken: Token given by botFather when new bot is created.
Create an account on Heroku and installHeroku CLI
curl https://cli-assets.heroku.com/install.sh| sudo sh
Login into Heroku
sudo heroku login
Goto heroku website and create anew app
. Note down the name of application when you create it. It will be used in below commands.
Clone this repository
git clone https://github.com/th3nyx/amazon-price-notify.git&& \cd amazon-price-notify&& \heroku git:remote -a YOUR-HEROKU-APPLICATION-NAME
Deploy your application and watch logs:
sudo git add.&& \sudo git commit -am"make it better"&& \sudo git push heroku master&& \heroku logs --tail
NOTE: Heroku free account kills the container after half an hour. Add your heroku application toUptimeRobot to keep it alive.
As of 2019-08-26: Heroku only allows 550hrs/month for free accounts without credit card verification.
Search for your bot on telegram and start conversation.
/start: Bot sends you an introduction
/add: Add your product
/alert: Create alert
Visitamazon-price-tracker-bot.herokuapp.com to spin up the heroku application if it's dead.
Search fortestbot13371
on Telegram and start the conversation.
Note:The test bot should work if Amazon.in haven't changed their HTML tags
- Use classes and object to support multiple products later.
- Use Threads to track multiple items on watch.
- Enable user to provide link directly from telegram app.
- Accept all kinds to URL
- Type checking of input data.
- Heroku integration.
- Overwrite old product when new product is added
- Randomize User-Agent to avoid IP ban from Amazon.
- Add cooldown timer once notification is sent.
- Add snooze command to stop notifications for that many hours.
- Exception handeling.
- Introduce database to stop the links, so server restart or script crash won't affect the links.
Future Work:
- Create a telegram menu and inlineKeyboard to replace commands.
- Support for multiple products per customer.
- If price of product is below threshold for more than 15 min. There will be multiple notifications.
Incorrect URL hangs the application.(FIXED)
About
Python script to monitor a product and send notification on telegram on price drop.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.