banner
年糕

年糕日记

此站为备份站点,最新文章请访问 oior.net
telegram
email

Aria2+Rclone enables offline downloading from cloud storage services such as OneDrive.

Preface#

Aria2 has a configuration option called on-download-complete, which allows you to execute a script or command after the download is complete. After the download is finished, Aria2 will pass three variables to the script: GID, file count, and file path. By using this configuration option and these variables, you can implement operations such as calling Rclone for uploading after the download is complete. In simple terms, the entire process involves downloading files to a VPS using Aria2 and then instructing Rclone to upload the files to cloud storage. In theory, as long as the cloud storage is supported by Rclone, you can implement pseudo offline downloading using this approach. Of course, this tutorial is not about teaching you how to write scripts, but rather providing a ready-made solution that can be easily implemented by following the instructions.

Preparation#

First, you need a suitable VPS for downloading.

Install Aria2#

Here, we will use the enhanced version of the Aria2 one-click installation and management script. Execute the following code to download and run the script. When the script menu appears, enter 1 to start the installation.

wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh

Install and Configure Rclone#

Rclone provides a one-click installation script:

curl https://rclone.org/install.sh | sudo bash

After installation, enter the command rclone config to enter the interactive configuration options. Follow the prompts to perform the configuration step by step. If you are confused, you can refer to the "Rclone Installation and Configuration Tutorial" for a detailed explanation of the configuration process.

Install JP#

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum repolist
yum install jq

Configure the Automatic Upload Script#

The enhanced version of the Aria2 one-click installation and management script integrates the perfect configuration for Aria2 and includes some additional functional scripts, one of which is the Rclone automatic upload script. Since it is not enabled by default, it needs to be manually enabled.

TIPS: The upload script of this project uses a more stable and faster native command upload method, rather than the mount method in the testing phase, which is different from general scripts.

  • Enter nano /root/.aria2c/aria2.conf to open the Aria2 configuration file for modification. Alternatively, use the manual modification option in the Aria2 one-click installation and management script (enhanced version) to open the configuration file for modification. Find the "Command to be executed after download is complete" and replace clean.sh with upload.sh.
# Command to be executed after download is complete
on-download-complete=/root/.aria2c/upload.sh
  • Enter nano /root/.aria2c/script.conf to open the additional functional script configuration file for modification. There are Chinese comments in the file, so modify it according to your actual situation. For the first use, it is recommended to only modify the cloud storage name.
# Cloud storage name (the name entered when configuring Rclone)
drive-name=OneDrive
  • Restart Aria2. Use the script option to restart or execute the following command:
service aria2 restart

Check if the Configuration is Successful#

  • Execute the upload.sh script. If it prompts success, it means that the upload script can be called normally. Otherwise, please check the configuration related to Rclone.
/root/.aria2c/upload.sh
  • Open the real-time log and download any file. If the upload is successful, it means that the configuration is successful. Otherwise, please carefully read the tutorial and start again.
  • Check if the relevant files exist in the cloud storage. If they do not exist, it means that you have selected the wrong cloud storage.

How to Use#

After completing all the above operations, downloaded files will be automatically uploaded to the corresponding cloud storage.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.