Skip to content

Track a specific product category page on JB Hi-fi and send alert when new products are added

Notifications You must be signed in to change notification settings

fachrulm/JB-track

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ JB Hi-Fi Product Monitor

Automatically monitor any JB Hi-Fi product collection for new items (or restock; based on changes in product number). Get instant email notifications when new products are added!

Monitor any product category: Collectibles, physical media, and more!

Python License Status

πŸ“¦ Installation

Prerequisites

  • Python 3.7 or higher
  • Chrome browser installed
  • Gmail account (for notifications)

Quick Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/pokemon-tcg-monitor.git
    cd pokemon-tcg-monitor
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure your settings:

    # Copy the configuration template
    cp config_template.py config.py
    
    # Edit config.py with your email settings (see Configuration section below)
  4. Run the monitor:

    python JB-track.py

🎯 Quick Examples

Magic the Gathering Products

# In your config.py
PRODUCT_NAME = "MTG"
TARGET_URL = "https://www.jbhifi.com.au/collections/collectibles-merchandise/magic-the-gathering"

Nintendo Switch 2 Games

# In your config.py
PRODUCT_NAME = "Nintendo Switch 2 Games"
TARGET_URL = "https://www.jbhifi.com.au/collections/games-consoles/nintendo-switch-2-games"

4K Ultra HD Movies

# In your config.py
PRODUCT_NAME = "4K Ultra HD blu-rays"
TARGET_URL = "https://www.jbhifi.com.au/collections/movies-tv-shows/movies-4k-ultra-hd"

βš™οΈ Configuration

Step 1: Copy Configuration Template

cp config_template.py config.py

Step 2: Edit Your Settings

Open config.py and update these essential settings:

# === PRODUCT CONFIGURATION ===
PRODUCT_NAME = "Pokemon TCG"  # What you're monitoring
TARGET_URL = "https://www.jbhifi.com.au/collections/collectibles-merchandise/pokemon-trading-cards"

# === EMAIL CONFIGURATION ===
EMAIL_USER = "youremail@gmail.com"           # Your Gmail address
EMAIL_PASSWORD = "your_16_char_app_password"  # Gmail App Password (see below)
NOTIFY_EMAIL = "youremail@gmail.com"          # Where to send alerts

# === MONITORING CONFIGURATION ===
CHECK_INTERVAL = 360  # Check every 6 minutes (360 seconds)

⚠️ Important: Never edit the main script file - all settings go in config.py!

πŸ“§ Email Setup

Step 1: Enable 2-Factor Authentication

  1. Go to Google Account Security
  2. Click 2-Step Verification and follow the setup process
  3. Complete all required steps including backup codes

Step 3: Generate Gmail App Password

  1. Go to Google Account Security
  2. Enable 2-Step Verification (if not already enabled)
  3. Complete all 2FA setup steps including backup codes
  4. Go to App Passwords
  5. Generate a new app password for "Pokemon Monitor"
  6. Copy the 16-character password and paste it into your config.py

⚠️ Important Security Notes:

  • Never use your regular Gmail password - it won't work and isn't secure
  • Keep your App Password private - treat it like a regular password
  • The config.py file is ignored by git - your credentials won't be uploaded to GitHub
  • You can revoke App Passwords anytime in your Google security settings

πŸ”§ Advanced Configuration

All settings are controlled through your config.py file. Here are the available options:

Monitoring Settings

CHECK_INTERVAL = 360        # Check every 6 minutes (in seconds), do NOT recommend lowering this
PRODUCT_NAME = "Your Product"  # Name used in notifications
TARGET_URL = "https://..."  # JB Hi-Fi collection URL to monitor
NOTIFY_ON_DECREASE = False  # Get alerts when products are removed (sold out)

Browser Settings

HEADLESS_MODE = True        # Set to False to see browser window (for debugging)
ENABLE_LOGGING = False      # Set to True for detailed Chrome output
TIMEOUT_SECONDS = 15        # How long to wait for page to load

Notification Settings

SEND_TEST_EMAIL = True      # Send confirmation email when script starts
DATA_FILE = "pokemon_count_data.json"  # Where to store baseline data

Error Handling

MAX_RETRIES = 3            # Number of retries on errors
RETRY_DELAY = 300          # Wait 5 minutes between retries

πŸƒβ€β™‚οΈ Usage

Basic Usage

# With configuration file
python JB-track.py

# First time (without config.py)
python JB-track.py
# Will show: "⚠️ config.py not found - using default settings"
# Copy config_template.py to config.py and configure your settings

Expected Output

βœ… Loaded settings from config.py
πŸš€ Starting JB Hi-Fi Product Monitor
🎯 Product: Nintendo Switch Games
πŸ“ Monitoring: https://www.jbhifi.com.au/collections/gaming/nintendo-switch
⏰ Check interval: 6 minutes
πŸ“§ Email notifications: Enabled
--------------------------------------------------
πŸ“§ Sending test email...
βœ… Notification sent!
πŸ” Checking Nintendo Switch Games products at 2025-07-30 19:45:00
πŸ“¦ Current: Showing 45 of 45 results
πŸ“ First run - establishing baseline count
😴 Sleeping for 6 minutes...

When New Products Are Found

πŸ†• ALERT: 3 new Nintendo Switch Games products detected!
πŸ”” NOTIFICATION: πŸŽ‰ NEW Nintendo Switch Games Products at JB Hi-Fi!
πŸ“§ Email sent successfully!

πŸ“ Project Structure

jb-hifi-product-monitor/
β”œβ”€β”€ README.md                    # This file
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ JB-track.py           # Main script (current version)
β”œβ”€β”€ config_template.py           # Configuration template
β”œβ”€β”€ config.py                    # Your settings (ignored by git)
β”œβ”€β”€ jb_hifi_monitor_v1.py        # Version 1: Basic requests
β”œβ”€β”€ jb_hifi_monitor_v2.py        # Version 2: Enhanced parsing
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ basic_usage.py          # Simple usage example
β”‚   └── advanced_config.py      # Advanced configuration example
└── docs/
    β”œβ”€β”€ troubleshooting.md      # Common issues and solutions
    └── changelog.md            # Version history

πŸ› οΈ Troubleshooting

Common Issues

"Could not find product count"

  • The script might need time for products to load
  • Check if JB Hi-Fi changed their website structure
  • Try setting HEADLESS_MODE = False in config.py to see what's happening

"Error setting up WebDriver"

  • Make sure Chrome is installed and up to date
  • Install/update webdriver-manager: pip install --upgrade webdriver-manager
  • Check if your antivirus is blocking ChromeDriver

"Error sending notification"

  • Verify your Gmail App Password is correct (16 characters, no spaces)
  • Make sure 2-Factor Authentication is fully set up with backup codes
  • Check if "Less secure app access" is disabled (this is correct)

"config.py not found"

  • Copy the template: cp config_template.py config.py
  • Edit config.py with your actual email settings
  • The script will work with defaults but email won't function

ChromeDriver version issues

  • The script uses webdriver-manager to auto-download compatible drivers
  • If it fails, you can manually download from ChromeDriver downloads

Debug Mode

To see more detailed output and browser actions, edit your config.py:

HEADLESS_MODE = False    # See the browser window
ENABLE_LOGGING = True    # Verbose Chrome output

βš–οΈ Legal & Ethics

  • βœ… Respectful monitoring - Configurable intervals won't overload servers (default: 6 minutes)
  • βœ… Public information - Only monitors publicly available product listings
  • βœ… No automated purchasing - Only monitors, doesn't buy anything
  • βœ… Universal tool - Works with any JB Hi-Fi product category
  • ⚠️ Use responsibly - Do NOT decrease the interval below 5 minutes

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

⚠️ Disclaimer

This tool is for educational and personal use only. The authors are not responsible for any misuse or any consequences of using this script. Use at your own risk and be respectful of JB Hi-Fi's servers and terms of service.


Happy product hunting! πŸ›οΈβœ¨

About

Track a specific product category page on JB Hi-fi and send alert when new products are added

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages