A Python script that updates rclone HTTP Remote configuration file (rclone.conf) with the latest URLs from specified websites using XPath, and notifies via Telegram if changes are detected.
- Supports multiple websites as a fallback.
- Automatically checks if the website is up and running.
- Verifies the correctness of XPath expressions used to extract data from the website.
- Stores information about the website links in an SQLite database to track updates.
- Updates the rclone configuration file (rclone.conf) with the latest URLs from the website.
- Executes customizable post-update command only after the rclone.conf updates.
- Notifies specified Telegram channel about updates using the Telegram Bot API.
- Python 3.6 or higher
requests
librarylxml
librarysqlite3
libraryTELEGRAM_CHAT_ID
andTELEGRAM_BOT_API_KEY
environment variables with valid values
- Clone or download this repository.
- Install the required libraries by running the following command:
pip install -r requirements.txt
- Set the
WEBSITE_URLS
environment variable with the website/s you want to fetch. - Set the
TELEGRAM_CHAT_ID
andTELEGRAM_BOT_API_KEY
environment variables with your Telegram chat ID and bot API key. - Set the
POST_COMMAND
with the command you want to execute only after update. - Change the
name_mappings
according to your setup
"Website Hypertext": "Rclone Remote Name",
- Run the script using the following command:
python main.py
If the website administrators make changes and break things, you may need to update the XPath expressions. Contributions in the form of pull requests are welcome. Remember that you don't need to update the script version if you make changes; the script will automatically update itself.
The Rclone HTTP Remote URL Updater script is written in Python and uses various libraries to perform its tasks. It utilizes the requests library to fetch the website, and the lxml library to parse the HTML on the page and extract relevant information using specified XPath values. The script connects to an SQLite database to check if a link is already in the database. If yes, it compares the old link with the new link and updates the link in the database, then updates the rclone configuration file (rclone.conf) with the new URL. It sends notifications to a Telegram channel using the Telegram Bot API with the information about the updated URL. The script uses the TELEGRAM_CHAT_ID and TELEGRAM_BOT_API_KEY environment variables to send notifications to the Telegram chat.
Everything in this repo developed using natural language processing capabilities from OpenAI's GPT-3.5