百度云/百度網(wǎng)盤Python客戶端github項目
系統(tǒng)環(huán)境:
linux與ma + python3.6
安裝依賴包
pip install requests
pip install bypy==1.6.10
授權(quán)登陸:
執(zhí)行 bypy info,顯示下邊信息,根據(jù)提示镶摘,通過瀏覽器訪問下邊灰色的https鏈接,如果此時百度網(wǎng)盤賬號正在登陸渴析,會出現(xiàn)長串授權(quán)碼梭稚,復(fù)制。
bypy info
顯示如下信息
Please visit: # 訪問下邊這個連接怨规,復(fù)制授權(quán)碼
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 # 提示在下邊粘貼授權(quán)碼
在下邊圖示紅色位置粘貼授權(quán)碼陌宿,耐心等待一會即可(1-2分鐘)
Authorizing, please be patient, it may take upto 300 seconds...
Authorizing with the Heroku server ...
Heroku server failed, authorizing with the Heroku1 server ...
Successfully authorized
Quota: 6.112TB
Used: 1.569TB
授權(quán)成功。
顯示在云盤(程序的)根目錄下文件列表:
bypy list
把當(dāng)前目錄同步到云盤:
bypy syncup
or
bypy upload
把云盤內(nèi)容同步到本地來:
bypy syncdown
or
bypy downdir /
比較本地當(dāng)前目錄和云盤(程序的)根目錄(個人認為非常有用):
bypy compare
更多增刪改查等操作可以執(zhí)行以下命令
bypy help
Commands:
refreshtoken - refresh the access token
cdl_add <source_url> [save_path] [timeout] - add an offline (cloud) download task
cdl_addmon <source_url> [save_path] [timeout] - add an offline (cloud) download task and monitor the download progress
cdl_cancel <task_id> - cancel an offline (cloud) download task
cdl_list - list offline (cloud) download tasks
cdl_query <task_ids> - query existing offline (cloud) download tasks
cleancache - remove invalid entries from hash cache file
combine <remotefile> [localfile] [md5s] - try to create a file at PCS by combining slices, having MD5s specified
compare [remotedir] [localdir] - compare the remote directory with the local directory
copy/cp <from> <to> - copy a file / dir remotely at Baidu Yun
delete/remove/rm <remotepath> - delete a file / dir remotely at Baidu Yun
downdir [remotedir] [localdir] - download a remote directory (recursively)
downfile <remotefile> [localpath] - download a remote file.
download [remotepath] [localpath] - download a remote directory (recursively) / file
dumpcache - display file hash cache
list/ls [remotepath] [format] [sort] [order] - list the 'remotepath' directory at Baidu PCS
listrecycle [start] [limit] - list the recycle contents
meta <remotepath> [format] - get information of the given path (dir / file) at Baidu Yun.
mkdir <remotedir> - create a directory at Baidu Yun
move/mv/rename/ren <from> <to> - move a file / dir remotely at Baidu Yun
quota/info - displays the quota information
restore <remotepath> - restore a file from the recycle bin
search <keyword> [remotepath] [recursive] - search for a file using keyword at Baidu Yun
stream <remotefile> <localpipe> [format] [chunk] - stream a video / audio file converted to M3U format at cloud side, to a pipe.
syncdown [remotedir] [localdir] [deletelocal] - sync down from the remote directory to the local directory
syncup [localdir] [remotedir] [deleteremote] - sync up from the local directory to the remote directory
upload [localpath] [remotepath] [ondup] - upload a file or directory (recursively)