对于一些大容量网盘,如OneDrive,Google云端硬盘等本身是不自带离线下载,现在我们可以借助第三方工具aria2实现高速多线程离线下载,如有Linux用户同样适用于多线程本地下载。

先附上一张效果图:

准备材料

  1. 装有Linux系统的电脑,推荐Debian/Ubuntu(大流量VPS更好)
  2. 懂点SSH连接

安装并配置aria2

这里推荐P3TERX大的一键脚本

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

这里因为P3TERX大已经配置好了aria2,目前已经是速度最快和BT trackers最多的配置,如果喜欢自定义配置可以参考aria2官方提供的安装脚本

如果你使用的Linux系统,至此已经完成了Linux本地下载器的搭建

挂载Rclone

客户端授权

在本地Windows电脑上下载rclone,下载地址:https://rclone.org/downloads/,解压文件夹,在此文件夹打开cmd命令,输入

1
rclone authorize "onedrive"

然后会弹出浏览器登陆即可,在返回cmd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
C:\Users\Administrator>cd /d d:\rclone

d:\rclone>rclone authorize "onedrive"
2018/01/23 20:28:56 NOTICE: Config file "C:\\Users\\Administrator\\.config\\rclo
ne\\rclone.conf" not found - using defaults
Choose OneDrive account type?
* Say b for a OneDrive business account
* Say p for a personal OneDrive account
b) Business
p) Personal
b/p> p #这里选择个人版,你想挂载Business就选择b
If your browser doesn't open automatically go to the following link: http://127.
0.0.1:53682/auth #接下来会弹出浏览器,要求你登录账号进行授权
Log in and authorize rclone for access
Waiting for code...
Got code
Paste the following into your remote machine --->
{"access_token":"xxxx"} #请复制{xx}整个内容,后面需要用到
<---End paste

安装Rclone

  1. 安装Rclone
    用SSH连接Debian/Ubuntu,输入Rclone官方给的安装脚本
    1
    wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh
  2. 初始化配置
    输入
    1
    rclone config
  3. 按注释输入
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    n) New remote
    s) Set configuration password
    q) Quit config
    n/s/q> n
    name> Rats #随便填,后面要用到
    Type of storage to configure.
    Choose a number from below, or type in your own value
    1 / Amazon Drive
    \ "amazon cloud drive"
    2 / Amazon S3 (also Dreamhost, Ceph, Minio)
    \ "s3"
    3 / Backblaze B2
    \ "b2"
    4 / Box
    \ "box"
    5 / Cache a remote
    \ "cache"
    6 / Dropbox
    \ "dropbox"
    7 / Encrypt/Decrypt a remote
    \ "crypt"
    8 / FTP Connection
    \ "ftp"
    9 / Google Cloud Storage (this is not Google Drive)
    \ "google cloud storage"
    10 / Google Drive
    \ "drive"
    11 / Hubic
    \ "hubic"
    12 / Local Disk
    \ "local"
    13 / Microsoft Azure Blob Storage
    \ "azureblob"
    14 / Microsoft OneDrive
    \ "onedrive"
    15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
    \ "swift"
    16 / Pcloud
    \ "pcloud"
    17 / QingCloud Object Storage
    \ "qingstor"
    18 / SSH/SFTP Connection
    \ "sftp"
    19 / Webdav
    \ "webdav"
    20 / Yandex Disk
    \ "yandex"
    21 / http Connection
    \ "http"
    Storage> 14 #选择14,Microsoft OneDrive,,注意该序列号会随时变化,看清楚再填
    Microsoft App Client Id - leave blank normally.
    client_id> #留空
    Microsoft App Client Secret - leave blank normally.
    client_secret> #留空
    Remote config
    Choose OneDrive account type?
    * Say b for a OneDrive business account
    * Say p for a personal OneDrive account
    b) Business
    p) Personal
    b/p> p #这里选择个人版,你想挂载Business就选择b
    Use auto config?
    * Say Y if not sure
    * Say N if you are working on a remote or headless machine
    y) Yes
    n) No
    y/n> n #选择n
    For this to work, you will need rclone available on a machine that has a web browser available.
    Execute the following on your machine:
    rclone authorize "onedrive"
    Then paste the result below:
    result> {"access_token":""} #输入之前在客户端授权的内容
    --------------------
    [Rats]
    client_id =
    client_secret =
    token = {"access_token":""}
    --------------------
    y) Yes this is OK
    e) Edit this remote
    d) Delete this remote
    y/e/d> y 选择y
    Current remotes:

    Name Type
    ==== ====
    Rats onedrive

    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 #选择q退出

配置自动上传脚本

  • 输入nano /root/.aria2c/upload.sh打开自动上传脚本进行编辑
    1
    2
    3
    4
    # Rclone 配置时填写的网盘名(name)
    DRIVE_NAME='Onedrive'
    # 网盘目录。即上传目标路径,留空为网盘根目录,末尾不要有斜杠。
    DRIVE_PATH='/DRIVEX/Download'
  • 输入nano /root/.aria2c/aria2.conf打开 Aria2 配置文件进行修改。
    1
    2
    # 下载完成后执行的命令
    on-download-complete=/root/.aria2c/upload.sh
  • 重启
    reboot

使用

注意

  • 离线下载完后脚本会自动删除本地文件,不用担心本地空间占用
  • 严格按照教程来进行操作不会遇到问题,如果有问题那一定是你自身的问题,请仔细阅读教程中的每一个字。
  • 如果你对nano编辑器不了解,可以看看这个https://blog.csdn.net/weixin_41293827/article/details/106812686
  • Shell软件推荐免费的Xshell,手机端推荐termius