Aria2下载完转移到无限GoogleDrive

2.a 安装rlcone
curl https://rclone.org/install.sh | sudo bash
2.b 连接GoogleDrive
rclone config
操作过程:
2019/01/05 19:53:18 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> gdrv                 //自己取个名字
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / A stackable unification remote, which can appear to merge the contents of several remotes
   \ "union"
 2 / Alias for a existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Hubic
   \ "hubic"
14 / JottaCloud
   \ "jottacloud"
15 / Local Disk
   \ "local"
16 / Mega
   \ "mega"
17 / Microsoft Azure Blob Storage
   \ "azureblob"
18 / Microsoft OneDrive
   \ "onedrive"
19 / OpenDrive
   \ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
21 / Pcloud
   \ "pcloud"
22 / QingCloud Object Storage
   \ "qingstor"
23 / SSH/SFTP Connection
   \ "sftp"
24 / Webdav
   \ "webdav"
25 / Yandex Disk
   \ "yandex"
26 / http Connection
   \ "http"
Storage> 12           // 和上面列表中的“Google Drive”对应,如果rclone版本有变化,这个列表也会变。注意观察。
** See help for drive backend at: https://rclone.org/drive/ **
Google Application Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>               // 直接回车,留空
Google Application Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>                // 直接回车,留空
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
scope> 1
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders. (see docs).
Enter a string value. Press Enter for the default ("").
root_folder_id>                // 直接回车,留空
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>                // 直接回车,留空
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=9fbe4546d2ce6d90623ad8c4736cf368        // 把这一段复制粘到浏览器里面,登录你的Google账号,授权。
Log in and authorize rclone for access
Enter verification code> 4/yxnUmeNfOkmGulUhbcBLUvxkrweoBGDTPaBalZWfuzgSxEZghBmX_A    // 从浏览器里面复制这一段粘过来。
Configure this as a team drive?
y) Yes
n) No
y/n> n
--------------------
[gdrv]
type = drive
scope = drive
token = {"access_token":"ya29.gVy_Qh_lgQwkpnqBy7PyeF2PPDzamO5uNuA88FdgwRtr_3nmiGC5OO8i7zm4JWrP-cE0GYyGHqWb7mnKyi8Ikh8ndrevcqDRTs8SsVkBHV9kws7VB0Ok99h3tpXt","token_type":"Bearer","refresh_token":"1/csdfwiudjvnzxkvnjbiouyjefknbuwhujczgber0","expiry":"2019-01-05T20:56:04.804906367Z"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name                 Type
====                 ====
gdrv                 drive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q

2.c 设置自动上传网盘的脚本
下载脚本并设置可执行属性。
wget https://github.com/crazypeace/aria2_auto_rclone/raw/master/aria2_moveto_rclonedrv.sh 
chmod +x aria2_moveto_rclonedrv.sh 
修改此脚本中的字段
# rclone链接的网盘的名称,也就是rclone config显示的Name那一列
rcloneDrive='gdrv'               
# aria2下载目录,也就是aria2的dir配置项的值
downloadPath='/usr/local/caddy/www/aria2/download'  
gdrv是刚刚rclone config中输入的名字。
下载目录路径根据实际情况修改。

修改Aria2的配置文件   /root/.aria2/aria2.conf   中的如下字段:(如果没有字段就新增一行)
on-download-complete=/root/aria2_moveto_rclonedrv.sh 
脚本的路径根据实际情况修改。

2.d 重启Aria2服务
service aria2 restart

评论

The Hot3 in Last 30 Days

RackNerd VPS搭V2Ray WSS梯子 年付 $10.98 1G端口 3T流量 17G存储 1GB内存