9d49a99916
Chrome extension for PokemonCenter monitoring with Discord notifications. Includes Python scripts for Target monitoring. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.8 KiB
6.8 KiB
Pokemon Stock Monitor - Setup Guide
Overview
This monitor watches retail sites for Pokemon TCG restocks and new drops, sending Discord notifications when products become available.
Supported Sites:
- Target (working)
- PokemonCenter (requires special setup - see below)
- Walmart (planned)
- BestBuy (planned)
Prerequisites
- Python 3.10+
- Chrome/Chromium browser
- Discord server with webhook access
- ~500MB disk space (for browser)
Quick Start (5 minutes)
1. Clone/Copy the Project
# Copy the pokemon-stock-monitor folder to your server
cd pokemon-stock-monitor
2. Install Dependencies
pip install -r requirements.txt
playwright install chromium
3. Configure Discord Webhook
- Open Discord → Your Server → Server Settings → Integrations → Webhooks
- Click "New Webhook"
- Name it "Pokemon Stock Monitor"
- Copy the Webhook URL
- Edit
config.py:
DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL_HERE"
4. Configure Sites to Monitor
Edit config.py:
# Enable the sites you want
SITES_ENABLED = ["target"] # Add "pokemoncenter" after special setup
# Customize check interval (seconds)
CHECK_INTERVAL_SECONDS = 60
# For headless server, set to True
HEADLESS = True
5. Run the Monitor
python main.py
You should see:
==================================================
Pokemon Stock Monitor
==================================================
Monitoring: target
Check interval: 60 seconds
==================================================
Running initial check...
Running as a Background Service
Option A: Using Screen (Linux)
# Start a screen session
screen -S pokemon-monitor
# Run the monitor
python main.py
# Detach: Press Ctrl+A, then D
# Reattach later: screen -r pokemon-monitor
Option B: Using systemd (Linux)
Create /etc/systemd/system/pokemon-monitor.service:
[Unit]
Description=Pokemon Stock Monitor
After=network.target
[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/path/to/pokemon-stock-monitor
ExecStart=/usr/bin/python3 main.py
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Then:
sudo systemctl daemon-reload
sudo systemctl enable pokemon-monitor
sudo systemctl start pokemon-monitor
# Check status
sudo systemctl status pokemon-monitor
# View logs
journalctl -u pokemon-monitor -f
Option C: Using Task Scheduler (Windows)
- Open Task Scheduler
- Create Basic Task → Name: "Pokemon Monitor"
- Trigger: "When the computer starts"
- Action: Start a program
- Program:
python - Arguments:
main.py - Start in:
C:\path\to\pokemon-stock-monitor
- Program:
- Check "Run whether user is logged on or not"
PokemonCenter Setup (Special - Requires GUI)
PokemonCenter has strong bot protection (Imperva). To monitor it:
Method 1: Use Real Chrome Profile (Recommended)
This uses your actual Chrome browser with all its cookies/history, making it appear human.
-
Find your Chrome profile path:
- Windows:
C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data - Linux:
~/.config/google-chrome - Mac:
~/Library/Application Support/Google/Chrome
- Windows:
-
Edit
config.py:
# Add this line
CHROME_USER_DATA_DIR = "C:\\Users\\USERNAME\\AppData\\Local\\Google\\Chrome\\User Data"
# Enable PokemonCenter
SITES_ENABLED = ["target", "pokemoncenter"]
# Must be False to use Chrome profile
HEADLESS = False
-
Important: Close Chrome before running the monitor (can't use same profile twice)
-
First run: Manually solve any CAPTCHA that appears, then the session should stay valid
Method 2: VM with Desktop Environment
If running on a headless server, set up a VM with a desktop:
- Install a lightweight desktop (XFCE, LXDE)
- Install Chrome and browse PokemonCenter manually once
- Run the monitor with
HEADLESS = False - Use VNC/RDP to check on it occasionally
Configuration Reference
config.py Options
# Discord webhook URL (required)
DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/..."
# Check interval in seconds (60 = 1 minute)
CHECK_INTERVAL_SECONDS = 60
# Sites to monitor
SITES_ENABLED = ["target"] # Options: "target", "pokemoncenter"
# URLs to monitor per site
TARGET_URLS = [
"https://www.target.com/s?searchTerm=pokemon+tcg",
]
POKEMON_CENTER_URLS = [
"https://www.pokemoncenter.com/category/tcg-cards?sort=relevance",
]
# Keyword filtering (optional)
KEYWORD_FILTER_ENABLED = False
KEYWORDS = ["chaos rising", "booster", "etb", "elite trainer"]
# Browser settings
HEADLESS = True # True for servers, False for desktop/VM
SLOW_MO = 0 # Slow down browser (ms) for debugging
# Logging level
LOG_LEVEL = "INFO" # DEBUG, INFO, WARNING, ERROR
Troubleshooting
"No products found"
- Check
debug_screenshot.pngordebug_target.pngin the project folder - The site may have changed its HTML structure
- Try increasing wait times in
browser.py
"Discord notification not sending"
- Verify webhook URL is correct in
config.py - Test webhook:
python -c "from discord_notifier import test_webhook; test_webhook()"
"Browser failed to start"
# Reinstall Playwright browsers
playwright install chromium --force
# On Linux, install dependencies
playwright install-deps chromium
"Access denied" / Bot blocked
- PokemonCenter: Use the Chrome profile method above
- Target: Should work, try increasing
CHECK_INTERVAL_SECONDSto 120+ - All sites: Don't run too frequently (rate limiting)
High CPU/Memory Usage
- Set
HEADLESS = True(uses less resources) - Increase
CHECK_INTERVAL_SECONDS - The browser stays open between checks (by design, for session persistence)
File Structure
pokemon-stock-monitor/
├── main.py # Entry point - run this
├── config.py # Configuration - edit this
├── browser.py # Browser automation
├── discord_notifier.py # Discord webhook
├── product_tracker.py # Tracks products for restock detection
├── products.json # Auto-generated product database
├── monitor.log # Log file
├── scrapers/
│ ├── base.py # Base scraper class
│ ├── pokemoncenter.py # PokemonCenter scraper
│ └── target.py # Target scraper
└── requirements.txt # Python dependencies
Adding More Sites
The scraper architecture is modular. To add a new site:
- Create
scrapers/newsite.pybased ontarget.py - Add to
scrapers/__init__.py - Add URL config to
config.py - Add check function to
main.py
Support
If you encounter issues:
- Check
monitor.logfor errors - Check debug screenshots (
debug_*.png) - Try running with
LOG_LEVEL = "DEBUG"for more info