This is a simple Python script that scrapes the Xbox consoles page on the Microsoft Store and stores the prices of each console in a SQLite database. It then checks if the price of a console has changed since the last time the script ran and sends a message to a Telegram chat if there has been a change.
Clone the repository:
git clone https://github.com/Baumfaust/xbox-price-tracker.git
Install the required dependencies:
pip install -r requirements.txt
Create a .env
file in the root directory of the project with the following variables:
BOT_TOKEN=<your Telegram bot token>
CHAT_ID=<the chat ID of the chat you want to send messages to>
Run the script:
python main.py
The script can be run manually or set up to run automatically at regular intervals using a scheduling tool like Cron or Task Scheduler. The script will check if the price of a console has changed since the last time it ran and send a message to the specified Telegram chat if there has been a change.
To run the script every 2 hours on Arch Linux using systemd, follow these steps:
Create a new systemd service file:
sudo nano /etc/systemd/system/xbox-price-tracker.service
Add the following configuration:
[Unit]
Description=Xbox Price Tracker
After=network-online.target
[Service]
Type=simple
User=<your username>
WorkingDirectory=<path to the project directory>
ExecStart=/usr/bin/python main.py
Restart=always
RestartSec=7200
[Install]
WantedBy=multi-user.target
Save the file and exit nano.
Reload the systemd daemon:
sudo systemctl daemon-reload
Enable the service to start on boot:
sudo systemctl enable xbox-price-tracker.service
Start the service:
sudo systemctl start xbox-price-tracker.service
The script will now run every 2 hours and send a message to your specified Telegram chat if there has been a change in the price of any Xbox console.
If you find any bugs or issues with the script, please feel free to submit an issue or pull request.
This project is licensed under the MIT License - see the LICENSE
file for details.