惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
C
Cisco Blogs
A
Arctic Wolf
月光博客
月光博客
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
量子位
小众软件
小众软件
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
N
Netflix TechBlog - Medium
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Y
Y Combinator Blog
P
Proofpoint News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Schneier on Security
D
Docker
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
GbyAI
GbyAI
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
H
Help Net Security
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tenable Blog
B
Blog
Know Your Adversary
Know Your Adversary
IT之家
IT之家

Rat's Blog - 百度

Linux VPS使用命令行快速查询百度网盘提取码 - Rat's Blog PanHelper:百度云盘搜索工具,可自动获取部分加密文件密码 - Rat's Blog 使用Linux VPS自动删除在百度贴吧的一切回复(黑历史) - Rat's Blog Speedpan:百度网盘满速下载工具,无需登录,也可直接下载BT种子 - Rat's Blog YunDownload重制版:新增扫描百度网盘重复文件、和谐文件、空文件夹功能 - Rat's Blog 百度网盘分享文件密码暴力破解器 - Rat's Blog Aria2c度盘下载器:可高速下载百度云文件 - Rat's Blog 一款高速下载百度云文件的神器:SpeedKoalaBD v7.1破解版 - Rat's Blog Proxyee-down:HTTP下载神器,支持百度云下载/全网嗅探/B站视频下载 - Rat's Blog
VPS使用BaiduPCS-Go高速下载百度网盘的文件,支持上传/离线下载等操作 - Rat's Blog
博主: Rat's · 2018-09-19 · via Rat's Blog - 百度

说明:今天折腾了下辣鸡的百度网盘,想从网盘上下点东西到VPS上,用到了博主之前分享过一个百度网盘的Python客户端BYPY,查看:VPS安装BYPY实现百度云文件上传/下载/同步,不过传输速度真的很慢,长期100KB不到,可能是我用国外服务器的缘故吧。然后无意间发现了另外一个客户端BaiduPCS-Go,基于Go编写,功能强大很多,还支持离线下载,关键是下载速度很快,比开了超级会员还爽。这里就分享下。

特色

  • 支持WindowsmacOSlinux、移动设备等。
  • 百度帐号多用户支持。
  • 下载网盘内文件,支持多个文件或目录下载,支持断点续传和单文件并行下载。
  • 上传本地文件,支持上传大文件(>2GB),支持多个文件或目录上传。
  • 离线下载,支持http/https/ftp/电驴/磁力链协议。

使用

Github地址:https://github.com/iikira/BaiduPCS-Go

1、下载BaiduPCS-Go
下载地址:点击查看,找到适合自己服务器的最新版本,这里以VPS64位系统为例。

#下载并解压程序,然后删除压缩文件
wget https://github.com/iikira/BaiduPCS-Go/releases/download/v3.5.6/BaiduPCS-Go-v3.5.6-linux-amd64.zip
unzip BaiduPCS-Go-v3.5.6-linux-amd64.zip && rm -rf BaiduPCS-Go-v3.5.6-linux-amd64.zip

2、登录百度账号

#进入到之前解压的文件里运行相关命令
cd BaiduPCS-Go-v3.5.6-linux-amd64
#登录百度云盘
./BaiduPCS-Go login

会要求你填用户名、密码,验证码。
请输入图片描述
这里是支持登录多个账号的,重复使用登录命令就可以了。多用户操作命令如下:

#列出已登录百度帐号列表
./BaiduPCS-Go loglist
#获取当前百度帐号
./BaiduPCS-Go who
#切换当前的百度帐号,<uid>请在列表里查看
./BaiduPCS-Go su <uid>
#退出当前登录的百度账号
./BaiduPCS-Go logout

3、查看网盘总空间和已使用的

./BaiduPCS-Go quota

这里好像会返回错误(目前来说是错误的),而且后面的下载等命令都会返回错误,因为配置文件里的appid暂时不可用了,然后某大佬想出了一个找到可用appid的方法。

先在程序解压文件里新建一个脚本,比如/root/BaiduPCS-Go-v3.5.5-linux-amd64

#进入到解压文件里
cd /root/BaiduPCS*
#新建appid.sh脚本文件
nano appid.sh

复制以下代码到脚本里:

#!/bin/bash

item=266718
function check(){
    ./BaiduPCS-Go config set -appid=$item &> /dev/null
    ./BaiduPCS-Go ls | grep -q 遇到错误
    if [ $? != 0 ];then
        echo "当前可用appid:$item ,已设置成功,BaiduPCS-Go 现可用正常使用了!"
    else
        let item+=1
        check
    fi
}
check

按住Ctrl+xy保存退出,然后运行脚本:

bash appid.sh

脚本会帮你找到一个可用的appid,并自动替换到配置文件里。
请输入图片描述
4、相关配置

#设置下载文件的储存目录,默认存在/root/Downloads
./BaiduPCS-Go config set -savedir /home

#设置下载最大并发量为200,建议值50~500,数值越大速度越高,但太高可能会出问题
./BaiduPCS-Go config set -max_parallel 200

5、下载文件
使用命令:

./BaiduPCS-Go d <网盘文件或目录的路径1> <文件或目录2> <文件或目录3> ...

命令示范:

#下载根目录rats.xx文件
./BaiduPCS-Go d rats.xx
#下载moe目录rats.xx文件
./BaiduPCS-Go d /moe/rats.xx

#下载根目录moe文件夹所有文件
./BaiduPCS-Go d /moe
#下载根目录moe文件夹的子文件夹rats所有文件
./BaiduPCS-Go d /moe/rats

6、上传文件
使用命令:

./BaiduPCS-Go u <本地文件/目录的路径1> <文件/目录2> <文件/目录3> ... <目标目录>

命令示范:

#将服务器上的/root/rats.xx文件上传到网盘根目录moe文件夹,如果是根目录则用/
./BaiduPCS-Go u /root/rats.xx /moe

#将服务器上的/root/rats文件夹及里面的文件上传到网盘根目录moe文件夹,如果是根目录则用/
./BaiduPCS-Go u /root/rats /moe

这工具命令实在太多,这里就只说比较有用的,其它的很多基本在网盘里自己就可以操作,关于离线下载等其它命令可以查看:Github地址


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/738/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。