A personal e-commerce price tracker for Amazon and Flipkart, allowing you to track product prices, view historical trends, receive alerts when prices drop. Built with Python, Selenium, SQLite, Streamlit, and Telegram notifications.
- Track Products: Add products from Amazon and Flipkart with target prices.
- Dashboard: View all tracked products with latest price, target, and status.
- Price History: Visualize historical price trends with interactive charts.
- Real-time Alerts: Get Telegram notifications for price drops or when target prices are reached.
- Scraping: Runs daily by scheduling.
-
Database
- Uses SQLite (
price_tracker.db) to store all product and pricing data. - Products table holds: product name, URL, source (Amazon/Flipkart), and target price.
- PriceHistory table tracks historical prices for each product.
- Uses SQLite (
-
Scraping
- Amazon: Handled by
scraper_amazon.py. - Flipkart: Handled by
scraper_flipkart.py. - Both use Selenium with
undetected_chromedriverto mimic human browsing and bypass bot detection on these e-commerce sites. scraper_runner.pycoordinates scraping for all products, updates the database, and triggers Telegram alerts when necessary.
- Amazon: Handled by
-
Notifications
telegram_notify.pysends real-time messages via the Telegram Bot API whenever a price drops or a target price is reached.
-
Dashboard
-
streamlit_app.pyprovides an interactive web interface to:- Add or remove products
- View all tracked products with current prices and status
- Explore historical price trends via interactive charts
- Run the scraper manually if needed
-
- Python 3.11+ – For all scripts and dashboard.
- Selenium + undetected_chromedriver – Robust scraping with bot detection bypass.
- SQLite – Lightweight, easy-to-use database for products and price history.
- Streamlit – Quick and interactive dashboard interface.
- Plotly – Dynamic charts for visualizing price trends.
- Telegram Bot API – Real-time notifications for price changes and targets.
- Clone the repository
git clone https://github.com/yourusername/price-tracker.git
cd price-tracker-
Create a Virtual Environment (optional):
python -m venv venv
-
Activate the Virtual Environment:
-
On Windows:
.\venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
-
-
Install dependencies
pip install -r requirements.txtRequirements include:
selenium,undetected-chromedriver,pandas,plotly,streamlit,requests
- Create database
python create_db.py- Run Streamlit dashboard
streamlit run streamlit_app.pyThis project uses a Telegram bot to send real-time alerts when:
- A tracked product’s price drops compared to the previous check.
- A product reaches or goes below your target price.
-
Create a Telegram Bot
- Open Telegram and go to BotFather or search for BotFather
- Start a chat and use
/newbotto create a new bot. - Note down the bot token provided.
-
Get Your Chat ID
- Start a chat with your bot or use an existing group.
- Send any message to the bot.
- Use
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdatesin your browser to retrieve the chat ID from the JSON response.
-
Update
constants.pyBOT_TOKEN = "<YOUR_TELEGRAM_BOT_TOKEN>" CHAT_ID = "<YOUR_CHAT_ID>"
You can automate price tracking by scheduling the scraper to run at specific times. If you are using a Python virtual environment, ensure the scheduler uses the environment's Python interpreter so all dependencies are available.
Windows (Task Scheduler):
- Open Task Scheduler → Create Task.
- Set Trigger: Daily at 7:30 PM.
- Set Action → Start a program:
Program/script: C:\path\to\venv\Scripts\python.exe
Add arguments: C:\path\to\price_tracker\scraper_runner.py
- Save and test the task.
Linux/macOS (Cron Job):
Run the scraper daily at 7:30 PM:
30 19 * * * /path/to/your/venv/bin/python /path/to/price_tracker/scraper_runner.py- Replace
/path/to/your/venvwith your virtual environment path. - Replace
/path/to/price_trackerwith the project directory.
Alternative (using a shell script):
#!/bin/bash
source /path/to/your/venv/bin/activate
python /path/to/price_tracker/scraper_runner.pyMake it executable:
chmod +x run_scraper.shAdd to cron:
30 19 * * * /path/to/price_tracker/run_scraper.shOnce the dashboard is running, you can easily manage and track products:
- Dashboard: View all tracked products with current price, target price, and status.
- Add Product: Add a new product by entering its name, URL, source (Amazon/Flipkart), and target price.
- Price History: Explore historical price trends with interactive charts to see how prices have fluctuated over time.
- Manual Scraper Run: Trigger the scraper manually from the dashboard to update prices immediately.
- Alerts: Receive real-time Telegram notifications when a price drops or a target is reached, keeping you informed even when you’re away from the dashboard.