在linux中安装BYPY来下载上传百度网盘文件

在linux下传文件是比较麻烦的一件事情,今天就利用python版的百度云盘/百度网盘在linux下玩耍

进行文件列表、下载、上传、比较、向上同步、向下同步,等操作

Github地址:https://github.com/houtianze/bypy

 

安装pip:

#CentOS 6.x 32位

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum install -y python-pip

#CentOS 6.x 64位

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y python-pip

#CentOS 7.x

yum install -y epel-release
yum install -y python-pip

#如果CentOS 7安装出现No package python-pip available,可以用以下命令进行安装

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

#Debian/Ubuntu系统

apt-get -y update
apt-get -y install python-pip

安装pip3:

#CentOS系统

wget –no-check-certificate https://www.moerats.com/usr/shell/Python3/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh

#Debian系统

wget –no-check-certificate https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh

然后安装的时候还报错了ERROR: The certificate of `www.moerats.com’ is not trusted.”

不得不用另外一条命令

apt-get install ca-certificates -y #Debian/Ubuntu

yum install ca-certificates -y #CentOS

#查看是否安装成功

pip3 -V

安装bypy

#pip安装

pip install bypy

#pip3安装

pip3 install bypy

等安装好之后,我们开始授权

执行命令

bypy info

然后会给一个链接,用浏览器打开,将授权码复制过来回车

以下是执行结果

root@:~# bypy info

Baidu PCS currently gives totally WRONG MD5 hash for remote files, and I AM NOT GOING TO ADAPT TO IT!
So it if doesn’t work, install version ‘1.6.10’ using the following command:
pip install bypy==1.6.10
Version 1.6.10 has a workaround for this.
### Seeking maintainer fo this `bypy` project, if you are interested, please create an issue at github, thanks. ###
—————————————————————-

Please visit:
https://openapi.baidu.com/o1uth/2.0/a2thorize?client_id=q8WE4EpCsau1oS0MplgMKNBn&response_type=code&redirect_uri=oob&scope=basic+netdisk
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done
028b67251f30e649a29f9dd0acf6fbd4
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: 5.007TB
Used: 1.215TB

—————————————————————-

常用命令
显示文件列表:

bypy list

比较当前目录和网站根目录文件:

bypy compare

上传单个文件的命令如下:

bypy upload 文件名

把当前目录上传到云盘:

bypy syncup 目录地址

bypy upload 目录地址

下载单个文件的命令如下:

bypy downfile 下载文件名

把云盘内容下载到本地来:

bypy syncdown 目录地址

bypy downdir 目录地址

详细解释请运行bypy命令

THE END