A complete guide to set up, run, and automate the Price Drop Tracker on Ubuntu/Linux.
- Ubuntu 20.04 or later
- Google Chrome installed
- Python 3.10 or later
- A Telegram account
- Open Telegram → search
@BotFather - Send
/newbot - Give it a name (e.g.
PriceTrackerBot) - Copy the token BotFather gives you — looks like:
This is your
7412345678:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxTELEGRAM_BOT_TOKEN
- Send any message to your new bot (e.g.
/start) - Visit this URL in your browser (replace
YOUR_TOKEN):https://api.telegram.org/botYOUR_TOKEN/getUpdates - Find
"chat":{"id": 123456789}in the response - That number is your
TELEGRAM_CHAT_ID
mkdir -p ~/Projects/price-tracker
cd ~/Projects/price-tracker# Install venv support (Ubuntu requires this)
sudo apt install python3.12-venv
# Create virtual environment
python3 -m venv venv
# Activate it
source venv/bin/activateYour terminal prompt will change to show
(venv)— this means it's active.
pip install requests beautifulsoup4 python-dotenv selenium webdriver-manager
# Optional — for Cloudflare-protected sites (Shopee, etc.)
pip install cloudscraper
# Optional — for heavy JS sites (better than Selenium)
pip install playwright
playwright install chromiumSave your installed versions:
pip freeze > requirements.txtnano .envPaste and fill in your values:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
PRODUCT_1_URL=https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html
PRODUCT_1_THRESHOLD=60.00
PRODUCT_1_NAME=Book Example
PRODUCT_2_URL=https://www.nike.com/my/t/promina-walking-shoes-CsDWSZ/FV6343-002
PRODUCT_2_THRESHOLD=400.00
PRODUCT_2_NAME=Nike Promina ShoesSave: Ctrl+O → Enter → Ctrl+X
Add as many products as you want by incrementing the number (PRODUCT_3, PRODUCT_4, etc.)
nano tracker.pyPaste the full script content, then save: Ctrl+O → Enter → Ctrl+X
nano .gitignoreAdd these lines:
.env
venv/
__pycache__/
*.pyc
debug_screenshot.png
Save: Ctrl+O → Enter → Ctrl+X
python3 tracker.pyExpected output:
====================================================
Price Drop Tracker — 2 product(s) to check
====================================================
🔍 Nike Promina Shoes
https://www.nike.com/my/t/...
⚙️ Detected JS-rendered site → using Selenium
✅ Price found via: [data-test='product-price']
💲 Current price: 379.00
🎯 Threshold: 400.00
📉 BELOW threshold! Sending alert...
✅ Telegram alert sent!
git init
git add .
git commit -m "feat: add price drop tracker"
git remote add origin https://github.com/YOUR_USERNAME/price-tracker.git
git push -u origin mainSo your tokens are never exposed in code:
- Go to your GitHub repo
- Click Settings → Secrets and variables → Actions
- Click New repository secret and add:
| Name | Value |
|---|---|
TELEGRAM_BOT_TOKEN |
Your bot token |
TELEGRAM_CHAT_ID |
Your chat ID |
Create the workflow file:
mkdir -p .github/workflows
nano .github/workflows/tracker.ymlPaste this:
name: Price Drop Tracker
on:
schedule:
- cron: "0 9 * * *" # Runs at 09:00 UTC every day
workflow_dispatch: # Also allows manual trigger from GitHub UI
jobs:
check-price:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run price tracker
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: python tracker.pySave: Ctrl+O → Enter → Ctrl+X
Commit and push:
git add .github/
git commit -m "feat: add GitHub Actions workflow"
git pushcd ~/Projects/price-tracker
source venv/bin/activate
python3 tracker.pyCtrl + C
deactivateRun this once to add a tracker command to your terminal:
echo "alias tracker='cd ~/Projects/price-tracker && source venv/bin/activate && python3 tracker.py'" >> ~/.bashrc
source ~/.bashrcNow just type tracker anywhere to start it.
Just append to your .env file:
PRODUCT_3_URL=https://www.lazada.com.my/your-product-url
PRODUCT_3_THRESHOLD=299.00
PRODUCT_3_NAME=Lazada HeadphonesNo code changes needed — ever.
| Site Type | Method Used | Examples |
|---|---|---|
| Plain HTML | requests | books.toscrape.com, Harvey Norman |
| JavaScript-rendered | Selenium | Nike, Lazada, Zalora, Amazon |
| Cloudflare-protected | cloudscraper | Shopee |
| Heavy JS | Playwright | Complex SPAs |
The script auto-detects which method to use based on the domain. If one method fails, it automatically falls back to another.
sudo apt install python3.12-venv
python3 -m venv venv
source venv/bin/activate# Take a screenshot to see what the browser loaded
# Check debug_screenshot.png in your project folder
xdg-open debug_screenshot.png- Make sure you sent a message to your bot first
- Search your bot name in Telegram and press Start
# Make sure Chrome is installed
google-chrome --version
# Reinstall webdriver-manager
pip install --upgrade webdriver-managerprice-tracker/
├── .github/
│ └── workflows/
│ └── tracker.yml ← GitHub Actions (auto-run daily)
├── venv/ ← Virtual environment (never commit)
├── tracker.py ← Main script
├── requirements.txt ← Locked dependency versions
├── .env ← Your secrets (never commit)
└── .gitignore ← Excludes .env and venv/
- Never commit your
.envfile - Never share your
TELEGRAM_BOT_TOKENpublicly - If your token is exposed, revoke it immediately via
@BotFather→/revoke - Always store tokens as GitHub Secrets for automated runs