BaiduPCS-Go 是一个基于 Go 语言开发的百度网盘命令行客户端,它是百度网盘非官方 API 的实现。相比官方客户端,它具有更高的下载速度、更好的跨平台支持,以及丰富的命令行功能。
主要特性
- 高速下载:绕过百度网盘的限速机制,实现满速下载(还是需要svip地)
- 多线程支持:支持多线程并发下载,充分利用带宽
- 跨平台:支持 Windows、Linux、macOS 等多个平台
- 断点续传:支持大文件的断点续传功能
- 批量操作:支持批量上传、下载、删除等操作
- 目录同步:本地与云端目录同步功能
- 文件分享:创建和管理分享链接
安装方法
1. 下载预编译版本
从 GitHub Releases 页面下载对应平台的可执行文件:
1 2 3
| wget https://github.com/qjfoidnh/BaiduPCS-Go/releases/download/v3.x.x/BaiduPCS-Go-v3.x.x-linux-amd64.zip unzip BaiduPCS-Go-v3.x.x-linux-amd64.zip
|
2. 从源码编译
1 2 3
| git clone https://github.com/qjfoidnh/BaiduPCS-Go.git cd BaiduPCS-Go go build
|
3. 使用包管理器(部分平台)
1 2 3 4 5
| brew install baidupcs-go
yay -S baidupcs-go
|
基本使用
1. 登录认证
1 2 3 4 5 6 7 8 9 10 11 12
| BaiduPCS-Go login
BaiduPCS-Go login -username=your_username -password=your_password
BaiduPCS-Go login -qr
BaiduPCS-Go login -bduss=<BDUSS> BaiduPCS-Go login -cookies="xxxx"
|
2. 基本信息查看
1 2 3 4 5 6 7 8
| BaiduPCS-Go who
BaiduPCS-Go quota
BaiduPCS-Go pwd
|
3. 文件和目录操作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| BaiduPCS-Go ls BaiduPCS-Go ls /path/to/directory
BaiduPCS-Go cd /path/to/directory
BaiduPCS-Go mkdir new_folder
BaiduPCS-Go rm file_or_folder BaiduPCS-Go rm -rf folder
BaiduPCS-Go mv old_name new_name
|
4. 文件上传
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| BaiduPCS-Go upload local_file.txt
BaiduPCS-Go upload local_file.txt /remote/path/
BaiduPCS-Go upload file1.txt file2.txt file3.txt
BaiduPCS-Go upload -r /local/directory/
BaiduPCS-Go upload -p 10 large_file.zip
|
5. 文件下载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| BaiduPCS-Go download file.txt
BaiduPCS-Go download file.txt -saveto /local/path/
BaiduPCS-Go download file1.txt file2.txt
BaiduPCS-Go download -r /remote/directory/
BaiduPCS-Go download -p 10 -l 8 large_file.zip
BaiduPCS-Go download -test file.txt
|
高级功能
1. 配置管理
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| BaiduPCS-Go config
BaiduPCS-Go config set -savedir /path/to/download
BaiduPCS-Go config set -max_download_rate 1MB
BaiduPCS-Go config set -max_parallel 10
BaiduPCS-Go config set -cache_size 1024KB
|
2. 分享管理
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| BaiduPCS-Go share set file.txt
BaiduPCS-Go share set -pwd mypassword file.txt
BaiduPCS-Go share list
BaiduPCS-Go share cancel share_id
BaiduPCS-Go transfer https://pan.baidu.com/s/xxxxx password
|
3. 搜索功能
1 2 3 4 5 6 7 8
| BaiduPCS-Go search keyword
BaiduPCS-Go search -path /directory keyword
BaiduPCS-Go search -t video keyword
|
4. 回收站操作
1 2 3 4 5 6 7 8
| BaiduPCS-Go recycle list
BaiduPCS-Go recycle restore file_id
BaiduPCS-Go recycle clear
|
性能优化技巧
1. 下载优化
1 2 3 4
| BaiduPCS-Go config set -max_parallel 50 BaiduPCS-Go config set -cache_size 10240KB BaiduPCS-Go download -p 50 -l 16 file.zip
|
2. 批量操作
1 2 3 4 5
| BaiduPCS-Go download *.mp4
BaiduPCS-Go download -r --include="*.pdf" /documents/
|
3. 断点续传
程序支持自动断点续传,下载中断后重新执行下载命令即可继续。
常用选项参数
-p 或 --parallel:设置并发数
-l 或 --load:设置分块数
-r 或 --recursive:递归操作
--saveto:指定保存路径
--include:包含文件模式
--exclude:排除文件模式
--test:测试模式
-y:自动确认操作
故障排除
常见问题解决:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| BaiduPCS-Go logout rm -rf ~/.config/BaiduPCS-Go
BaiduPCS-Go config set -proxy http://proxy:port
BaiduPCS-Go config set -max_parallel 5
BaiduPCS-Go login -bduss=xxxx or BaiduPCS-Go login -cookies="xxxx"
|