Linux 下載百度網盤文件

Linux 下載百度網盤文件

1. 準備環境: centos7.2 python2.7+ pip

2. 安裝工具

pip install requests -i https://pypi.doubanio.com/simple
pip install bypy -i https://pypi.doubanio.com/simple

3. 授權

  • 命令行輸入 bypy info, 如下:
[root@iZ8vbdz4rng8x76417crnnZ setuptools-1.4.2]# bypy info
Please visit:
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done
  • 複製鏈接到瀏覽器上授權, 並複製授權碼到命令行中, 回車, 如下:
[root@iZ8vbdz4rng8x76417crnnZ setuptools-1.4.2]# byby info
-bash: byby: command not found
[root@iZ8vbdz4rng8x76417crnnZ setuptools-1.4.2]# bypy info
Please visit:
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Authorizing, please be patient, it may take upto 300 seconds...
Authorizing with the Heroku server ...
Successfully authorized

Quota: 2.008TB
Used: 885.847GB

下載文件

  • 授權完成後, 可在百度網盤中看到目錄 "我的應用數據" > "bypy", 將需要下載的文件放到該目錄中
  • 命令行輸入 bypy info 可查看網盤信息, 如:
[root@iZ8vbdz4rng8x76417crnnZ setuptools-1.4.2]# bypy info
Quota: 2.005TB
Used: 1.123TB
  • 命令行輸入 bypy list即可在Linux中看到網盤中的文件, 如下:
[root@iZ8vbdz4rng8x76417crnnZ setuptools-1.4.2]# bypy list
/apps/bypy ($t $f $s $m $d):
D testfiles 0 2021-07-30, 15:40:12
  • 命令行輸入 bypy downdir -v 下載當前路徑所有文件, 或輸入bypy downdir filename -v下載指定文件
  • 命令行輸入 bypy upload -v filename 上傳文件
  • 命令行輸入 bypy -cbypy -q 清除授權或退出
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章