This project is a Python-based web scraper designed to monitor Pokemon card prices and stock availability on TrollAndToad. It supports two types of scrapes:
- Search-based: Iterates through a search URL (with pagination) to extract details for multiple products.
- Item-based: Scrapes details from a specific product page.
The scraper compares current data with previously stored data (in scraped_data.json) and sends notifications via a Discord webhook when:
- A product is added for the first time.
- A price drop is detected.
- Stock availability changes.
- Data Extraction: Retrieves product name, URL, price, and stock status.
- Dual Mode Scraping: Supports both search-based (multiple items) and item-based (single item) scraping.
- Data Comparison: Saves scraped data to
scraped_data.jsonand compares it to detect changes. - Discord Notifications: Sends formatted alerts via a Discord webhook.
- Automated Installation: An installer script (
installer.py) is provided to set up required dependencies.
- Python 3.x
Required Python packages:
requestsbeautifulsoup4
- Windows: Open Command Prompt and run:
python --version
or
py --version
python3 --version
If Python is not installed or not found in PATH, please install it first. (See the optional platform‑specific installer scripts below.)
An automated installer script is provided. In the project directory, run:
python installer.py
This script will:
- Create a requirements.txt file (if it doesnt exist).
- Install the required packages.
If you need to automate Python installation itself, you can use the following platform‑specific scripts.
Create and run a PowerShell script (e.g., install_python.ps1) as administrator:
$python = Get-Command python -ErrorAction SilentlyContinue
if ($python) {
Write-Host "Python is already installed."
exit
}
$pythonUrl = "https://www.python.org/ftp/python/3.10.8/python-3.10.8-amd64.exe"
$output = "python-installer.exe"
Write-Host "Downloading Python from $pythonUrl..."
Invoke-WebRequest -Uri $pythonUrl -OutFile $output
Write-Host "Installing Python..."
Start-Process -FilePath $output -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
Remove-Item $output
Write-Host "Python installation complete."
Run the script with administrator privileges.
Create a Bash script (e.g., install_python.sh) for Debian‑based systems:
#!/bin/bash
sudo apt-get update
sudo apt-get install -y python3 python3-pip
echo "Python and pip have been installed."Make the script executable:
chmod +x install_python.sh
Then run it:
./install_python.sh
This file specifies the URLs to scrape. Its structure is:
{
"discord_webhook_url": "https://discord.com/api/webhooks/xxxxxxxxxxx................",
"search": [
"https://www.trollandtoad.com/category.php?...",
"..."
],
"item": [
"https://www.trollandtoad.com/pokemon/...",
"..."
]
}- search: List of search URLs for scraping multiple products.
- item: List of individual product URLs.
This file stores the previous scrapes data and is used to detect changes in price or stock.
Update the discord_webhook_url in the config.json with your Discord webhook URL to receive notifications.
Once the dependencies are installed and configuration is set up, run:
python PokeBot.py
The script will:
- Scrape data from the URLs specified in items.json.
- Compare it with data in scraped_data.json.
- Send Discord notifications for updates or new products.
- Save the new data to scraped_data.json.
- No output or errors: Verify that your URLs in items.json are correct and that your internet connection is active.
- Python not found: Ensure Python is installed and available in your system's PATH.
- Discord notifications not appearing: Double-check that the webhook URL is correct and that your network permits outgoing connections to Discord.
This project is provided "as is" without warranty. Feel free to modify it for your own use.
🤘
