Skip to content

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.

License

Notifications You must be signed in to change notification settings

origamiofficial/rclone-http-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rclone HTTP Remote URL Updater

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.

Features

  • 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.

Requirements

  • Python 3.6 or higher
  • requests library
  • lxml library
  • sqlite3 library
  • TELEGRAM_CHAT_ID and TELEGRAM_BOT_API_KEY environment variables with valid values

Usage

  1. Clone or download this repository.
  2. Install the required libraries by running the following command:
pip install -r requirements.txt
  1. Set the WEBSITE_URLS environment variable with the website/s you want to fetch.
  2. Set the TELEGRAM_CHAT_ID and TELEGRAM_BOT_API_KEY environment variables with your Telegram chat ID and bot API key.
  3. Set the POST_COMMAND with the command you want to execute only after update.
  4. Change the name_mappings according to your setup
"Website Hypertext": "Rclone Remote Name",
  1. Run the script using the following command:
python main.py

Contribution

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.

How it works

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.

Credit

Everything in this repo developed using natural language processing capabilities from OpenAI's GPT-3.5

Hits

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages