Giter Club home page Giter Club logo

baidupcs-py's Introduction

BaiduPCS-Py

PyPI version Build Gitter

A BaiduPCS API and An App

BaiduPCS-Py 是百度网盘 pcs 的非官方 api 和一个命令行运用程序。

也是 https://github.com/PeterDing/iScript/blob/master/pan.baidu.com.py 的重构版。

BaiduPCS-Py 旨在为个人用户提供操作自己用户网盘文件的 api 和简易命令行工具,不提供任何下载加速破解的服务。普通用户下载是限速的。想要下载不限速,请购买 SVIP。


阿里云盘 api 和 命令行客户端在 https://github.com/PeterDing/AliPCS-Py


用户相关命令

无感加密解密文件

文件操作相关命令

秒传相关命令

分享相关命令

离线下载相关命令

HTTP 服务

安装

需要 Python 版本大于或等于 3.7

pip3 install Cython
pip3 install BaiduPCS-Py

Windows 依赖

在 Windows 上,BaiduPCS-Py 依赖 Microsoft C++ Build Tools

在安装 BaiduPCS-Py 前,请先安装 Microsoft C++ Build Tools,再在其中勾选 C++ 生成工具 并安装。完成后即可安装 BaiduPCS-Py。

更新

pip3 install BaiduPCS-Py --upgrade

API

BaiduPCS-Py 的百度网盘 API 只依赖 requests,方便用户开发自己的运用。

from baidupcs_py.baidupcs import BaiduPCSApi

api = BaiduPCSApi(bduss=bduss, cookies=cookies)

注意,下面几个 api 不是线程安全的:

  • BaiduPCSApi.access_shared
  • BaiduPCS.access_shared
  • BaiduPCSApi.shared_paths
  • BaiduPCS.shared_paths

用法

BaiduPCS-Py --help

命令别名

可以用下面的命令别名代替原来的命令名。

别名 原名
w who
uu updateuser
su su
ul userlist
ua useradd
an accountname
ep encryptpwd
ud userdel
l ls
f search
md mkdir
mv move
rn rename
cp copy
rm remove
d download
p play
u upload
sn sync
rl rplist
rs rpsearch
rp rp
S share
sl shared
cs cancelshared
lsp listsharedpaths
s save
a add
t tasks
ct cleartasks
cct canceltasks
sv server

对多个帐号进行相同操作

BaiduPCS-Py 支持对多个帐号进行相同操作。比如,用相同关键字搜索多个帐号,上传相同的文件/目录到多个帐号,等等。

使用者只需用 --accounts (或 -u) 选项来指定要操作的帐号名即可。

--accounts 接受一个参数,这个参数是用“,”连接的要进行操作帐号名的部分字符。假设我们现在有 3 个帐号,帐号名分别是 TomPeterJoy。 现在我要同时对TomJoy进行关键字搜索。我们可以用下面的命令进行:

BaiduPCS-Py --accounts 'Tom,Joy' search 'keyword' / -R

或者给出帐号名的部分片段:

BaiduPCS-Py --accounts 'om,oy' search 'keyword' / -R

更简单可以用:

# Tom, Joy 都包含字符 "o"
BaiduPCS-Py --accounts 'o' search 'keyword' / -R

如果要对所有帐号进行操作用 --accounts ''

如果不使用 --accounts 选项,默认只对当前帐号进行操作。

以下命令支持对多个帐号进行操作:

  • pwd
  • ls
  • search
  • cat
  • mkdir
  • move
  • rename
  • copy
  • remove
  • download
  • play
  • upload
  • sync
  • rp
  • share
  • shared
  • cancelshared
  • save
  • add
  • tasks
  • cleartasks
  • canceltasks
  • purgetasks
  • server

注意: --accounts 一定要跟在 BaiduPCS-Py 后,命令前。

自动补全

在 Bash, Zsh 和 Fish 上 BaiduPCS-Py 命令支持自动补全。

  • 在 Bash 上,加入下面一行到 ~/.bashrc

    eval "$(_BAIDUPCS_PY_COMPLETE=bash_source BaiduPCS-Py)"

  • 在 Zsh 上,加入下面一行到 ~/.zshrc

    eval "$(_BAIDUPCS_PY_COMPLETE=zsh_source BaiduPCS-Py)"

  • 在 Fish 上,加入下面一行到 ~/.config/fish/completions/foo-bar.fish

    eval (env _BAIDUPCS_PY_COMPLETE=fish_source BaiduPCS-Py)

添加用户

BaiduPCS-Py 目前不支持用帐号登录。需要使用者在 pan.baidu.com 登录后获取 cookies 和其中的 bduss 值,并用命令 useradd 为 BaiduPCS-Py 添加一个用户。

使用者可以用下面的方式获取用户的 cookies 和 bduss 值。

  1. 登录 pan.baidu.com
  2. 打开浏览器的开发者工具(如 Chrome DevTools)。
  3. 然后选择开发者工具的 Network 面板。
  4. 在登录后的页面中任意点开一个文件夹。
  5. 在 Network 面板中找到 list?.... 一行,然后在右侧的 Headers 部分找到 Cookie: 所在行,复制 Cookie: 后的所有内容作为 cookies 值,其中的 BDUSS=...;... (没有最后的字符;)作为 bduss 值。

cookies

现在找到了 cookies 和 bduss 值,我们可以用下面的命令添加一个用户。

交互添加:

BaiduPCS-Py useradd

或者直接添加:

BaiduPCS-Py useradd --cookies "cookies 值" --bduss "bduss 值"

你也可以只添加 bduss,省去 cookies (或 cookies 中没有 STOKEN 值),但这会让你无发使用 sharesave 命令来转存其他用法的分享文件。

BaiduPCS-Py 支持多用户,你只需一直用 useradd 来添加用户即可。

设置账号名

BaiduPCS-Py accountname --account-name "my account"
Option Description
--account-name, --an TEXT 设置账号名,用于指定运行帐号和显示

显示当前用户的信息

BaiduPCS-Py who

或者:

BaiduPCS-Py who user_id

指明显示用户 id 为 user_id 的用户信息。

选项

Option Description
-K, --show-encrypt-password 显示加密密码

更新用户信息

默认更新当前用户信息。

BaiduPCS-Py updateuser

也可指定多个 user_id

BaiduPCS-Py updateuser user_id
Option Description
--all 更新所有用户信息

显示所有用户

BaiduPCS-Py userlist

切换当前用户

BaiduPCS-Py su

或者指定用户列表中用户所在的位置:

BaiduPCS-Py su 2

删除一个用户

BaiduPCS-Py userdel

设置文件加密密码

注意v0.5.17 加密的文件格式(Version 2)不兼容以后的版本。

BaiduPCS-Py 支持“无感的”文件加密。

BaiduPCS-Py 可以加密上传文件,在下载的时候自动解密,让使用者感觉不到加密解密的过程。

如果使用者需要将保密文件上传至百度网盘保存,可以使用这个方法。即使帐号被盗,攻击者也无法还原文件内容。

BaiduPCS-Py 支持以下加密方法:

  • Simple 一种简单的加密算法。根据密钥生成一个字节对照表来加密解密文件。 速度快,但不安全,不建议加密重要文件。 因为这种算法加解密不需要知道上下文信息,所以,下载时支持分段下载,如果是媒体文件则支持拖动播放。 推荐用于加密不重要的媒体文件。
  • ChaCha20 工业级加密算法,速度快,推荐用于加密重要文件。不支持分段下载。
  • AES256CBC 工业级加密算法,推荐用于加密重要文件。不支持分段下载。

注意:用命令 encryptpwd 设置的密码只是为当前用户的。

为当前用户设置加密密码:

交互添加:

BaiduPCS-Py encryptpwd

或者直接添加:

BaiduPCS-Py encryptpwd --encrypt-password 'my-encrypt-password'

上传并加密文件:

上传和同步文件时只需要指定加密算法就可。如果不指定就不加密。

# 默认使用上面设置的 `encrypt-password`
BaiduPCS-Py upload some-file.mp4 some-dir/ /to/here --encrypt-type AES256CBC

下载并用上面设置的 encrypt-password 自动解密文件:

BaiduPCS-Py download /to/here/some-file.mp4 /to/here/some-dir/

也可以使用临时的 encrypt-password

BaiduPCS-Py upload some-file.mp4 some-dir/ /to/here --encrypt-type Simple --encrypt-password 'onlyyou'

但在使用临时的 encrypt-password 后,cat、下载和播放这些文件时需要指定 encrypt-password,但不需要指定加密算法,程序会自动检查加密算法:

# 下载
BaiduPCS-Py download /to/here/some-file.mp4 /to/here/some-dir/  --encrypt-password 'onlyyou'

# 开启本地服务并播放
BaiduPCS-Py play /to/here/some-file.mp4 --encrypt-password 'onlyyou' --use-local-server

显示当前用户的密钥:

BaiduPCS-Py who --show-encrypt-password

BaiduPCS-Py 下载时默认会解密文件,如果想要下载但不解密文件,需要加 --no-decrypt

BaiduPCS-Py download some-file --no-decrypt

文件操作

BaiduPCS-Py 操作网盘中的文件可以使用文件的绝对路径或相对路径(相对与当前目录 pwd)。

每一个用户都有自己的当前工作目录(pwd),默认为 / 根目录。

使用者可以用 cd 命令来切换当前的工作目录(pwd)。

下面所有涉及网盘路径的命令,其中如果网盘路径用的是相对路径,那么是相对于当前工作目录(pwd)的。 如果是网盘路径用的是绝对路径,那么就是这个绝对路径。

显示当前工作目录

BaiduPCS-Py pwd

切换当前工作目录

切换到绝对路径:

BaiduPCS-Py cd /to/some/path

切换到相对路径:

# 切换到 (pwd)/../path
BaiduPCS-Py cd ../path

列出网盘路径下的文件

BaiduPCS-Py ls [OPTIONS] [REMOTEPATHS]...

BaiduPCS-Py ls /absolute/path

# or
BaiduPCS-Py ls relative/path

选项

Option Description
-r, --desc 逆序排列文件
-n, --name 依名字排序
-t, --time 依时间排序
-s, --size 依文件大小排序
-R, --recursive 递归列出文件
-I, --include TEXT 筛选包含这个字符串的文件
--include-regex, --IR TEXT 筛选包含这个正则表达式的文件
-E, --exclude TEXT 筛选 包含这个字符串的文件
--exclude-regex, --ER TEXT 筛选 包含这个正则表达式的文件
-f, --is-file 筛选 目录文件
-d, --is-dir 筛选目录文件
--no-highlight, --NH 取消匹配高亮
-S, --show-size 显示文件大小
-D, --show-date 显示文件创建时间
-M, --show-md5 显示文件 md5
-A, --show-absolute-path 显示文件绝对路径
--show-dl-link, --DL 显示文件下载连接
--show-hash-link, --HL 显示文件秒传连接
--hash-link-protocol, --HLP [cs3l | short | bdpan] 显示文件 hash 链接,并指定协议
--no-check-md5, --NC 显示文件 cs3l:// 连接时不检查 md5
--csv 用 csv 格式显示,单行显示,推荐和 --DL 或 --HL 一起用
--only-dl-link, --ODL 只显示文件下载连接
--only-hash-link, --OHL 只显示文件秒传连接

统计路径下文件所占用空间

统计网盘路径下的文件所占用的空间

BaiduPCS-Py du [OPTIONS] [REMOTEPATHS]...

# 统计特定文件
BaiduPCS-Py du /some/path --include .mp4
Option Description
-R, --recursive 递归计算所有文件
-I, --include TEXT 筛选包含这个字符串的文件
--include-regex, --IR TEXT 筛选包含这个正则表达式的文件
-E, --exclude TEXT 筛选 不 包含这个字符串的文件
--exclude-regex, --ER TEXT 筛选 不 包含这个正则表达式的文件

搜索文件

搜索包含 keyword 的文件

BaiduPCS-Py search [OPTIONS] KEYWORD [REMOTEDIR]

# 在当前工作目录中搜索
BaiduPCS-Py search keyword

# or
BaiduPCS-Py search keyword /absolute/path

# or
BaiduPCS-Py search keyword relative/path

选项

Option Description
-R, --recursive 递归搜索文件
-I, --include TEXT 筛选包含这个字符串的文件
--include-regex, --IR TEXT 筛选包含这个正则表达式的文件
-E, --exclude TEXT 筛选 包含这个字符串的文件
--exclude-regex, --ER TEXT 筛选 包含这个正则表达式的文件
-f, --is-file 筛选 目录文件
-d, --is-dir 筛选目录文件
--no-highlight, --NH 取消匹配高亮
-S, --show-size 显示文件大小
-D, --show-date 显示文件创建时间
-M, --show-md5 显示文件 md5
--csv 用 csv 格式显示

显示文件内容

BaiduPCS-Py cat [OPTIONS] REMOTEPATH

选项

Option Description
-e, --encoding TEXT 文件编码,默认自动解码
--no-decrypt, --ND 不解密
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的

创建目录

BaiduPCS-Py mkdir [OPTIONS] [REMOTEDIRS]...

选项

Option Description
-S, --show 显示目录

移动文件

移动一些文件到一个目录中。

BaiduPCS-Py move [OPTIONS] [REMOTEPATHS]... REMOTEDIR

选项

Option Description
-S, --show 显示结果

文件重命名

BaiduPCS-Py rename [OPTIONS] SOURCE DEST

选项

Option Description
-S, --show 显示结果

拷贝文件

拷贝一些文件到一个目录中。

BaiduPCS-Py move [OPTIONS] [REMOTEPATHS]... REMOTEDIR

选项

Option Description
-S, --show 显示结果

删除文件

BaiduPCS-Py remove [OPTIONS] [REMOTEPATHS]...

下载文件或目录

BaiduPCS-Py download [OPTIONS] [REMOTEPATHS]...

注意: 请用 me, aget_pyaget_rs 下载大于 5MB 的文件。用 aria2 下载大于 5MB 的文件会失败。 (#27)

--chunk-size 从 v0.6.27 开始不能大于 5M,这是百度服务的限制。超过 5M 会报 403 错误。

选项

Option Description
-o, --outdir TEXT 指定下载本地目录,默认为当前目录
-R, --recursive 递归下载
-f, --from-index INTEGER 从所有目录中的第几个文件开始下载,默认为 0(第一个)
-I, --include TEXT 筛选包含这个字符串的文件
--include-regex, --IR TEXT 筛选包含这个正则表达式的文件
-E, --exclude TEXT 筛选 不 包含这个字符串的文件
--exclude-regex, --ER TEXT 筛选 不 包含这个正则表达式的文件
-s, --concurrency INTEGER 下载同步链接数,默认为 5。数子越大下载速度越快,但是容易被百度封锁
-k, --chunk-size TEXT 同步链接分块大小,最大不能超过 5M
-q, --quiet 取消第三方下载应用输出
--out-cmd, --OC 输出第三方下载应用命令
-d, --downloader [ me | aget_py | aget_rs | aria2 ] 指定下载应用

默认为 me (BaiduPCS-Py 自己的下载器,支持断续下载)
me 使用多文件并发下载。

除 me 外,其他下载器,不使用多文件并发下载,使用一个文件多链接下载。
如果需要下载多个小文件推荐使用 me,如果需要下载少量大文件推荐使用其他下载器。对于 SVIP 用户,用哪个下载器都很快。

aget_py (https://github.com/PeterDing/aget) 默认安装
aget_rs (下载 https://github.com/PeterDing/aget-rs/releases)
aria2 (下载 https://github.com/aria2/aria2/releases)
--player-params, --DP TEXT 第三方播放器参数
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的

播放媒体文件

BaiduPCS-Py play [OPTIONS] [REMOTEPATHS]...

注意: 大于 5MB 的媒体文件无法直接播放,需要加 -s 使用本地服务器播放。

play 命令默认播放带有媒体后缀的文件,如 abc.mp4, abc.mp3。如果需要播放的媒体文件没有用常规的媒体文件后缀,则需要加选项 --ignore-ext

选项

Option Description
-R, --recursive 递归播放
-f, --from-index INTEGER 从所有目录中的第几个文件开始播放,默认为 0(第一个)
-I, --include TEXT 筛选包含这个字符串的文件
--include-regex, --IR TEXT 筛选包含这个正则表达式的文件
-E, --exclude TEXT 筛选 不 包含这个字符串的文件
--exclude-regex, --ER TEXT 筛选 不 包含这个正则表达式的文件
--player-params, --PP TEXT 第三方播放器参数
-m, --m3u8 获取 m3u8 文件并播放
-q, --quiet 取消第三方播放器输出
--shuffle, --sf 随机播放
--ignore-ext, --IE 不用文件名后缀名来判断媒体文件
--out-cmd, --OC 输出第三方播放器命令
-p, --player [mpv] 指定第三方播放器

默认为 mpv (https://mpv.io)
-s, --use-local-server 使用本地服务器播放。大于 5MB 的媒体文件无法直接播放,需要使用本地服务器播放
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的

上传文件

上传一些本地文件或目录到网盘目录。

BaiduPCS-Py 首先会尝试秒传。如果秒传失败,会使用分片上传上传文件。

上传过程中,按 “p” 可以暂停或继续上传。

BaiduPCS-Py upload [OPTIONS] [LOCALPATHS]... REMOTEDIR

指定上传方式:

--upload-type Many: 同时上传多个文件。

适合大多数文件长度小于 100M 以下的情况。

BaiduPCS-Py upload --upload-type Many [OPTIONS] [LOCALPATHS]... REMOTEDIR

--upload-type One: 一次只上传一个文件,但同时上传文件的多个分片。

适合大多数文件长度大于 1G 以上的情况。

BaiduPCS-Py upload --upload-type One [OPTIONS] [LOCALPATHS]... REMOTEDIR

指定同时上传连接数量:

--max-workers 默认为 CPU 核数。

BaiduPCS-Py upload --max-workers 4 [OPTIONS] [LOCALPATHS]... REMOTEDIR

注意:upload 上传本地目录有改变

  • 小于 v0.6.8 的版本,如果上传本地目录 localdir 到远端目录 remotedir,BaiduPCS-Py 是将 localdir 下的所有文件(包括下级目录)上传到远端目录 remotedir 下。

    比如,localdir 下有 2 个文件 ab 和一个下级目录 sub/,如果运行 BaiduPCS-Py upload localdir remotedir,结果是远端目录 remotedir 下增加了 2 个文件 ab 和一个下级目录 sub/

  • 大于或等于 v0.6.8 的版本,如果上传本地目录 localdir 到远端目录 remotedir,BaiduPCS-Py 是将 localdir 这个目录上传到远端目录 remotedir 下。

    比如,localdir 下有 2 个文件 ab 和一个下级目录 sub/,如果运行 BaiduPCS-Py upload localdir remotedir,结果是远端目录 remotedir 下增加了 1 个下级目录和它的所有文件 localdir/alocaldir/b 和一个下级目录 localdir/sub/

    如果要将 localdir 下的所有文件(包括下级目录)上传到远端目录 remotedir,用 BaiduPCS-Py upload localdir/* remotedir

选项

Option Description
-t, --upload-type [One | Many] 上传方式,Many (默认): 同时上传多个文件,One: 一次只上传一个文件,但同时上传文件的多个分片
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的
-e, --encrypt-type [No | Simple | ChaCha20 | AES256CBC] 文件加密方法,默认为 No 不加密
-w, --max-workers INTEGER 同时上传文件连接数量,默认为 CPU 核数
--no-ignore-existing, --NI 上传已经存在的文件
--no-show-progress, --NP 不显示上传进度
--check-md5, --CM 分段上传后检查 md5。注意检查上传后大文件的 md5,可能会花数分中(2G 的文件需要大约 5 分钟)

同步本地目录到远端

同步本地目录到远端。

如果本地文件最后修改时间或大小和远端不同则上传文件。对于本地不存在的文件但远端存在则删除远端文件。

BaiduPCS-Py sync [OPTIONS] LOCALDIR REMOTEDIR

选项

Option Description
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的
-e, --encrypt-type [No | Simple | ChaCha20 | AES256CBC] 文件加密方法,默认为 No 不加密
-w, --max-workers INTEGER 同时上传文件数
--no-show-progress, --NP 不显示上传进度
--check-md5, --CM 分段上传后检查 md5。注意检查上传后大文件的 md5,可能会花数分中(2G 的文件需要大约 5 分钟)

关于秒传

百度网盘在服务器上对于一份文件只储存一份。如果一份文件已经存在于百度网盘的服务器中,用户无需重新上传源文件,只需要提供文件的特征参数就可完成上传,这种上传文件的方法百度叫做“秒传”。

运用“秒传”的功能,我们将一份文件变成一组特征参数。只要获得这组特征参数,我们就可以在百度网盘中“生成”这组特征参数对应的唯一文件。

BaiduPCS-Py 可以获取百度网盘中文件的特征参数,并将其转化为一串连接。使用这个连接,使用者可以在任何帐号中“生成”对应文件,达到文件分享的功能。

BaiduPCS-Py 支持 3 种秒传连接(在 BaiduPCS-Py 叫 Hash Link)协议:

  1. cs3l

cs3lContent_md5 + Slice256k_md5 + content_crc32 + content_Length 的缩写。

格式: cs3l://<content_md5>#<slice_md5>#<content_crc32>#<content_length>#<filename>

例如: cs3l://ced58db7aedce8e1c887754fccccde03#0d02589467f34bdd86d08221e93b2783#2518837112#33251183#test.gz

BaiduPCS-Py 默认使用 cs3l 协议连接。

  1. short

shortcs3l 格式的缩写版。最早出自于梦姬度盘标准提取码

格式: <content_md5>#<slice_md5>#<content_length>#<filename>

例如: ced58db7aedce8e1c887754fccccde03#0d02589467f34bdd86d08221e93b2783#33251183#test.gz

  1. bdpan

bdpan 是 pandownload 使用的协议连接。

格式: bdpan://{base64(<filename>|<content_length>|<content_md5>|<slice_md5>)}

例如: bdpan://Q29udGVudHMtYW1kNjQuZ3p8MzMyNTExODN8Y2VkNThkYjdhZWRjZThlMWM4ODc3NTRmY2NjY2RlMDN8MGQwMjU4OTQ2N2YzNGJkZDg2ZDA4MjIxZTkzYjI3ODM=

BaiduPCS-Py 会将在命令 lsuploadsyncrp 中遇到的文件特征参数存储于本地 sqlite3 数据库 ~/.baidupcs-py/rapiduploadinfo.sqlite3。使用 rplistrpsearch 命令可以查看这些信息。

显示网盘中文件的秒传连接

使用 ls 命令显示秒传连接默认会对文件进行秒传检查,已确认服务器是否已经将文件特征记录。

对于才上传的大文件,服务器不会立刻计算完文件的特征参数,这个过程可能持续数天的时间。在此期间秒传无法进行。

如果想略过秒传检查,用户可以用 --no-check-md5 选项。但这样生成的秒传连接可能是无效的。

注意:显示秒传连接需要请求文件 256KB 的内容。如果用户是非 svip 且请求的文件很多,那么这个过程要花很长时间。BaidPCS-Py 使用 10 个线程来请求,如果是非 svip,每个文件请求可能要花 5 秒。

# 默认显示 cs3l 协议连接
BaiduPCS-Py ls /path/to/file --show-hash-link

# 或者用 --show-hash-link 缩写 --HL
BaiduPCS-Py ls /path/to/file --HL

指定特定协议:

BaiduPCS-Py ls /path/to/file --show-hash-link --hash-link-protocol bdpan

如果连接过长,可以加选项 --csv,让输出变为 csv 格式。

BaiduPCS-Py ls /path/to/file --show-hash-link --csv

列出保存的文件秒传信息

BaiduPCS-Py rplist [OPTIONS] [IDS]...

如果不给出 ids,默认为对所有数据进行操作。

选项

Option Description
-f, --filename 按文件名排序
-t, --time 按时间排序
-s, --size 按文件大小排序
-l, --localpath 按本地名排序
-r, --remotepath 按远端名排序
-u, --userid 按用户 id 排序
-n, --username 按用户名排序
-d, --desc 按逆序排序
-L, --limit INTEGER 限制列出文件个数
-O, --offset INTEGER 列出偏移位
--hash-link-protocol, --HLP [cs3l | short | bdpan] hash link 协议, 默认 cs3l
--show-all, -A 显示文件所有信息
--only-hash-link, --OHL 只显示文件秒传连接

搜索保存的文件秒传信息

BaiduPCS-Py rpsearch [OPTIONS] KEYWORD

选项

Option Description
--filename, --fn 在文件名中搜索
--localpath, --lp 在本地路径中搜索
--remotepath, --rp 在远端路径中搜索
--username, --un 在用户名中搜索
-m, --md5 在 md5 中搜索。注意保存的文件 md5 都是小写字符
--hash-link-protocol, --HLP [cs3l | short | bdpan] hash link 协议, 默认 cs3l
--show-all, -A 显示文件所有信息
--only-hash-link, --OHL 只显示文件秒传连接

用秒传连接或参数上传

BaiduPCS-Py rp [OPTIONS] [REMOTEDIR]

使用秒传连接:

# 将秒传连接指向的文件保存到远端路径 /path/to/save
BaiduPCS-Py rp /path/to/save --link 'cs3l://ced58db7aedce8e1c887754fccccde03#0d02589467f34bdd86d08221e93b2783#2518837112#33251183#test.gz'

BaiduPCS-Py rp /path/to/save --link 'ced58db7aedce8e1c887754fccccde03#0d02589467f34bdd86d08221e93b2783#33251183#test.gz'

BaiduPCS-Py rp /path/to/save --link 'bdpan://Q29udGVudHMtYW1kNjQuZ3p8MzMyNTExODN8Y2VkNThkYjdhZWRjZThlMWM4ODc3NTRmY2NjY2RlMDN8MGQwMjU4OTQ2N2YzNGJkZDg2ZDA4MjIxZTkzYjI3ODM='

从指定文件获取要使用的秒传连接,文件中一行一个秒传连接。

BaiduPCS-Py rp /path/to/save --input-file links.txt --max-workers 5

使用特征参数:

BaiduPCS-Py rp /path/to/save \
    --content-md5 'ced58db7aedce8e1c887754fccccde03' \
    --slice-md5 '0d02589467f34bdd86d08221e93b2783' \
    --content-length '33251183' \
    --filename 'test.gz'

如果同时有 --link--filename,那么 --filename 值将代替 link 中的文件名。

选项

Option Description
-l, --link TEXT cs3l:// 协议连接 或 简化连接
-i, --input-file TEXT 从指定文件获取要使用的秒传连接;只能是一行一个秒传连接
--slice-md5, --sm TEXT 文件前 256KB md5
--content-md5, --cm TEXT 文件 md5
--content-crc32, --cc INTEGER 文件 crc32, 可以为空
--content-length, --cl INTEGER 文件长度
--filename, --fn TEXT 文件名,如果这里设置了,将会覆盖 link 中的文件名
--no-ignore-existing, --NI 上传且覆盖已经存在的文件
-w, --max-workers INTEGER 同时上传文件数

分享文件

注意:使用这个命令需要 cookies 中含有 STOKEN 值。

BaiduPCS-Py share [OPTIONS] [REMOTEPATHS]...

选项

Option Description
-p, --password TEXT 设置秘密,4 个字符。默认没有秘密
--period-time, --pt INTEGER 设置分享有效期,单位为天

列出分享链接

BaiduPCS-Py shared

选项

Option Description
-A, --show-all 显示所有分享的链接,默认只显示有效的分享链接

取消分享链接

BaiduPCS-Py cancelshared [OPTIONS] [SHARE_IDS]...

列出其他用户分享链接中的文件

注意:使用这个命令需要 cookies 中含有 STOKEN 值。

BaiduPCS-Py listsharedpaths [OPTIONS] SHARED_URL

选项

Option Description
-p, --password TEXT 链接密码,如果没有不用设置
--no-show-vcode, --NV 不显示验证码,如果需要验证码则报错

保存其他用户分享的链接

注意:使用这个命令需要 cookies 中含有 STOKEN 值。

保存其他用户分享的链接到远端目录。

BaiduPCS-Py save [OPTIONS] SHARED_URL REMOTEDIR

选项

Option Description
-p, --password TEXT 链接密码,如果没有不用设置
--no-show-vcode, --NV 不显示验证码,如果需要验证码则报错

添加离线下载任务

BaiduPCS-Py add [TASK_URLS]... REMOTEDIR

百度网盘支持添加 magnet 和 http/s 的离线任务。

如果添加 magnet 连接需要指定要下载的文件类型:

  • m: 媒体文件 (默认)
  • i: 图片文件
  • d: 文档文件
  • c: 压缩文件
  • a: 所有文件

比如,要下载所有的媒体文件和文档文件:

BaiduPCS-Py add 'magnet:?xt=urn:btih:8e54536d364ad24f8a9b7ab0c08d52436341f131' /to/path --file-type 'm,d'

选项

Option Description
-t, --file-type TEXT 要下载的文件类型,m:媒体文件,i:图片文件,d:文档文件,c:压缩文件,a:所有文件。用','分割。

列出离线下载任务

# 列出所有离线下载任务
BaiduPCS-Py tasks

# 也可列出给定id的任务。
BaiduPCS-Py tasks [TASK_IDS]...

清除已经下载完和下载失败的任务

BaiduPCS-Py cleartasks

取消下载任务

BaiduPCS-Py canceltasks [TASK_IDS]...

删除所有离线下载任务

BaiduPCS-Py purgetasks

选项

Option Description
--yes 确认并直接运行

开启 HTTP 服务

在远端 ROOT_DIR 目录下开启 HTTP 服务。

ROOT_DIR 默认为 /

BaiduPCS-Py server [OPTIONS] [ROOT_DIR]

如果需要设置认证,使用下面的选项设置用户名和密钥:

BaiduPCS-Py server [ROOT_DIR] --username 'foo' --password 'bar'

也可以指定服务路径:

BaiduPCS-Py server [ROOT_DIR] --path '/my/pan'

# 访问 http://localhost:8000/my/pan/

选项

Option Description
--path TEXT 服务路径,默认为 “/”
-h, --host TEXT 监听 host
-p, --port INTEGER 监听 port
-w, --workers INTEGER 进程数
--encrypt-password, --ep TEXT 加密密码,默认使用用户设置的
--username TEXT HTTP Basic Auth 用户名
--password TEXT HTTP Basic Auth 密钥

baidupcs-py's People

Contributors

ipixeloldc avatar masaiki avatar nvv5 avatar peterding avatar zoubenjia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baidupcs-py's Issues

异地登录限制

作者你好!感谢开发这么完善的库。我遇到的问题是在挂美国VPN的时候一切正常,但用德国IP就无法在Python代码里登陆(命令行模式也一样),会出错如下:

Traceback (most recent call last):
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "C:\Users\Bo\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

请问是什么原因呢?已经换过Cookies,浏览器重新登陆等等(浏览器上在哪个IP登陆都没有问题)。非常感谢!

baidupcs-py userlist 提示v0.6.17 system error

baidupcs-py userlist 提示v0.6.17 system error

WARNNING: Please to search the similar bugs, before you report a bug. Don't report a similar bug which existed.
注意:在你提交一份报告前,请先搜索是否存在类似的报告。请勿重复提交内容相同的报告。

Prerequisites / 报告前提
Before you report a bug, please let the bug to be reproduced at the latest verion of BaiduPCS-Py.
在你提交报告前,请在 BaiduPCS-Py 的最新版本上复现问题。

At sometimes, there are errors occured by an expired cookie. Before you commit the report, please to check whether cookies are expired.
有时一些错误是由于某个 cookie 超期导致的。在你提交报告前,请先检查你的 cookies 是否超期。

Describe the bug / 描述 bug
A clear and concise description of what the bug is.
请清楚的描述你遇到的问题。

To Reproduce / 复现问题
Steps to reproduce the behavior:

  1. Do '...'
  2. Do '....'
  3. ...
  4. See error

按照下面的步骤可以复现问题:

  1. 做 '...'
  2. 做 '...'
  3. ...
  4. 问题出现

Screenshots / 问题截图
If applicable, add screenshots to help explain your problem.

Don't show BDUSS and cookies.

如果可能,请附加问题截图。

不要出现 BDUSScookies

Envrionment / 运行环境

  • OS: [e.g. Windows]
  • Python [e.g. Python3.8]
  • BaiduPCS-Py Version [e.g. 0.6.9]

Runing log / 运行日志
Please follow steps to paste the content of file ~/.baidupcs-py/running.log.

  1. Remove the file ~/.baidupcs-py/running.log if it exists.
  2. Run the command where the bug occurs with envrionment variable LOG_LEVEL=DEBUG.
    e.g. LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. Paste the content of file ~/.baidupcs-py/running.log after the bug occurs.

Don't show BDUSS and cookies.

请按照下面的步骤贴出运行日志 ~/.baidupcs-py/running.log 中的内容。

  1. 删除 ~/.baidupcs-py/running.log,如果存在。
  2. 在问题发生的命令前加入环境变量 LOG_LEVEL=DEBUG
    例如:LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. 在问题出现后,贴出 ~/.baidupcs-py/running.log 中的内容。

不要出现 BDUSScookies

Additional context / 补充内容
Add any other context about the problem here.
在这里增加补充内容。

一直无法在Windows10安装

  ERROR: Failed building wheel for baidupcs-py
ERROR: Could not build wheels for baidupcs-py which use PEP 517 and cannot be installed directly

Windows10 64位系统
python3.8
pip21.0.1
Windows折腾很久无法安装,非常难受

请教是否可以实现群组文件搜索,谢谢。

这不是一个bug报告,先感谢大佬的伟大工程。让我们生活方便了很多。

百度网盘群组一直不支持搜索功能,要找个文件非常麻烦。请问有什么办法吗,给点提示谢谢。

我目前是抓包写了个脚本,递归调用接口一层层访问下去,然后在本地创建一样的文件结构,(都是空文件),感觉很低效,群组一有变化又得扫一遍。麻烦大佬看看有没有简单的api。谢谢

System ERROR: AutoDecryptRequest - Request Error

本来都可以运行的 但是今天发现下载的时候报错: (v0.6.21) System ERROR: AutoDecryptRequest - Request Error
环境: Ubuntu 18.4, IP是在美国 之前都是下的好好的突然不行了
同一个账户我用国内的机器就可以

转存分享链接报错 (v0.6.9) System ERROR:

在windows试了下登录,创建分享,查看文件夹都没问题,但是转存的时候不成功,报 (v0.6.9) System ERROR:
命令类似于:
BaiduPCS-Py save --password mfgq https://pan.baidu.com/s/1ajltWp8Bu0dXU_NE10eC4g /
python 是 3.9.2版本, baidupcs-py是0.6.9

下载时,没有反应

WARNNING: Please to search the similar bugs, before you report a bug. Don't report a similar bug which existed.
注意:在你提交一份报告前,请先搜索是否存在类似的报告。请勿重复提交内容相同的报告。

Prerequisites / 报告前提
Before you report a bug, please let the bug to be reproduced at the latest verion of BaiduPCS-Py.
在你提交报告前,请在 BaiduPCS-Py 的最新版本上复现问题。

At sometimes, there are errors occured by an expired cookie. Before you commit the report, please to check whether cookies are expired.
有时一些错误是由于某个 cookie 超期导致的。在你提交报告前,请先检查你的 cookies 是否超期。

Describe the bug / 描述 bug
A clear and concise description of what the bug is.
请清楚的描述你遇到的问题。

To Reproduce / 复现问题
Steps to reproduce the behavior:

  1. 输入 BaiduPCS-Py download -o F:\BaiduNetdiskDownload 没有反应

按照下面的步骤可以复现问题:

  1. 做 '...'
  2. 做 '...'
  3. ...
  4. 问题出现

Screenshots / 问题截图
If applicable, add screenshots to help explain your problem.

1

如果可能,请附加问题截图。

不要出现 BDUSScookies

Envrionment / 运行环境

  • OS: Windows 10 企业版 LTSC
  • Python Python3.9.5
  • BaiduPCS-Py Version 0.6.18

Runing log / 运行日志
Please follow steps to paste the content of file ~/.baidupcs-py/running.log.

  1. Remove the file ~/.baidupcs-py/running.log if it exists.
  2. Run the command where the bug occurs with envrionment variable LOG_LEVEL=DEBUG.
    e.g. LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. Paste the content of file ~/.baidupcs-py/running.log after the bug occurs.

Don't show BDUSS and cookies.

请按照下面的步骤贴出运行日志 ~/.baidupcs-py/running.log 中的内容。

  1. 删除 ~/.baidupcs-py/running.log,如果存在。
  2. 在问题发生的命令前加入环境变量 LOG_LEVEL=DEBUG
    例如:LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. 在问题出现后,贴出 ~/.baidupcs-py/running.log 中的内容。

不要出现 BDUSScookies

Additional context / 补充内容
Add any other context about the problem here.
在这里增加补充内容。

关于这个项目api使用的一些问题

您好,

我在使用 BaiduPCSApi 这个模块时,能否给我一个分片上传文件到baidupan的example。因为这个项目好像没有对这个模块有比较详细的介绍。 因为我在查阅您的分片上传的api时,自己没有太理解。

感谢。

[已解决] 关于在Borg增量备份的客户端Vorta中,备份完成后,自动执行通过bash脚本进行百度云同步时出现的问题

错误日志(重点就这一句,样子大概不是这样,前面还会跟个BaiduPCS-Py的版本号,但我剪贴板里面被覆盖掉了,反正就是有这一行句子):[Errno 25] Inappropriate ioctl for device

这个问题已经解决了,我发这个issue,只是记录一下,方便后来者解决,如果需要利用BaiduPCS-Py进行Borg备份同步时,在Vorta中怎么也无法同步成功,而在终端里面却可以的问题。

这其实是个通病,用这里的话说,就是BaiduPCS-Py只能在一个终端里面运行,在其他地方是无法运行的(如Vorta的子进程下)。我的实测也是这样的。但是隔壁Rclone却可以运行,所以不知道是软件本身的问题(包括Vorta,不知道Rclone是怎么处理这种情况的),还是语言/库本身的问题。

This would happen if stdout isn't a terminal (e,g,, redirecting to a file or run as a subprocess and its a pipe). There are different terminal types, like physical terminal attached via a serial line, that may not accept that ioctl. But if this is a linux machine and its default terminal emulator, it should work. Just guesses here. – tdelaney Aug 10 '20 at 18:26
https://stackoverflow.com/questions/63345739/ioerror-errno-25-inappropriate-ioctl-for-device

目前的解决方法就是在一个终端里面跑BaiduPCS-Py,比如我是在BaiduPCS-Py命令前面加了个Kitty命令(kitty BaiduPCS-Py sync /xxx /xxx)。这个命令会让BaiduPCS-Py在Kitty这个终端里面运行。这样就可以执行成功了。当然你可以换其他的终端。反正是个 终端就行。

系统环境

  • Linux 5.9.16 发行版 Manjaro最新版
  • Python 3.9.2 由包管理器安装的。BaiduPCS-Py的权限是700。运行时的权限也没有问题。

开启server 是否限速了

已经排除了我本地网络环境的问题 开启server 后 用chrome 浏览器 下载 最大下载速度只能达到 3m/s 我是部署在本机用localhost访问,我们本地正常下载速度10m/s以上

另外我已经开通了vip 下载速度可以达到8m/s以上

无法使用 aria2 下载

Describe the bug / 描述 bug
同一个文件,用 自带的 me 下载器是可以下载的,历时10分钟。但是使用 aria2 就出错了。

To Reproduce / 复现问题
Steps to reproduce the behavior:

  1. BaiduPCS-Py download Clash.for.Windows.Setup.0.9.5.exe -s 2 -d aria2 -o /dev/shm/baidu_download/

Screenshots / 问题截图
Download: /Clash.for.Windows.Setup.0.9.5.exe to /dev/shm/baidu_download/Clash.for.Windows.Setup.0.9.5.exe

03/17 18:50:09 [NOTICE] Downloading 1 item(s)

03/17 18:50:09 [ERROR] CUID#7 - Download aborted. URI=http: 。。。。

Exception: [AbstractCommand.cc:351] errorCode=22 URI=http:。。。。
-> [HttpSkipResponseCommand.cc:239] errorCode=22 The response status is not successful. status=403

03/17 18:50:09 [NOTICE] Download GID#02c69835d4f0b49e not complete: /dev/shm/baidu_download/Clash.for.Windows.Setup.0.9.5.exe.tmp

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
02c698|ERR | 0B/s|/dev/shm/baidu_download/Clash.for.Windows.Setup.0.9.5.exe.tmp

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.
aria2c fails. return code: 22

Envrionment / 运行环境

  • OS: linux kernel 5.7
  • Python 3.8.5
  • BaiduPCS-Py Version 0.6.12

请按照下面的步骤贴出运行日志 ~/.baidupcs-py/running.log 中的内容。

  1. ~/.baidupcs-py/running.log 文件为空。

MACOS 无法贴入 Cookie

MACOS 无法贴入 Cookie 能否使用解析文件的方式?

还有既然已经贴 Cookie 了 能否从 Cookie 中拆出 bduss?

下载速度最多 3MB/s 的问题

#47 这个问题在我这也出现了。

我的账号是 SVIP4 ,无论用手机官方 App 还是 pc 端都可以满速下载,宽带能跑满 11MB/s ,手机 5G 实测可以跑到 80+MB/s ,因此可推断账号是没有黑号的。

我在 Win10 上运行 BaiduPCS-Py 无论如何都是最多只有 3MB/s,也尝试了提高线程数和减小分块大小,但都没有用。楼上提到换 Linux 可以满速,但我在虚拟机 Linux 中运行 BaiduPCS-Py 实测还是一样。

但上述操作中,Win10 和 Linux 中使用的网络环境和账号都是相同的,因此我在 Win10 和 Linux 中分别测试了 电信 100Mbps 和 移动 300Mbps,但结果都是不超过 3MB/s。看起来似乎和网络没有关系。

我想换个账号试试但我没有其他的 SVIP 账号,但我注意到 github 上的另外一个项目 BaiduPCS-Go 。我在 Win10 和 Linux 上分别运行那个程序,都能达到 10MB/s,只不过有点波动,我只用了 电信 100Mbps 网络测试,如果用更快的网络也许还会超过 10MB/s。

同一个账号,同一个硬件环境,同一个网络环境,但不同的程序,我觉得是 BaiduPCS-Py 的问题(没有批判的意思,这个项目对我帮助很大,所以我才来提 issue 希望能帮助改进)。

我注意到 BaiduPCS-Py 和 BaiduPCS-Go 的登陆方式不一样,前者是使用者自行在网页版获取 BDUSS 和 cookies ;后者是使用者输入账号和密码,程序模拟登陆后获取登录信息。不知道问题是否跟这个有关?

建议增加 BaiduPCS-Py su 1这样的直接切换用户命令

建议增加 BaiduPCS-Py su 1这样的直接切换用户命令

WARNNING: Please to search the similar bugs, before you report a bug. Don't report a similar bug which existed.
注意:在你提交一份报告前,请先搜索是否存在类似的报告。请勿重复提交内容相同的报告。

Prerequisites / 报告前提
Before you report a bug, please let the bug to be reproduced at the latest verion of BaiduPCS-Py.
在你提交报告前,请在 BaiduPCS-Py 的最新版本上复现问题。

At sometimes, there are errors occured by an expired cookie. Before you commit the report, please to check whether cookies are expired.
有时一些错误是由于某个 cookie 超期导致的。在你提交报告前,请先检查你的 cookies 是否超期。

Describe the bug / 描述 bug
A clear and concise description of what the bug is.
请清楚的描述你遇到的问题。

To Reproduce / 复现问题
Steps to reproduce the behavior:

  1. Do '...'
  2. Do '....'
  3. ...
  4. See error

按照下面的步骤可以复现问题:

  1. 做 '...'
  2. 做 '...'
  3. ...
  4. 问题出现

Screenshots / 问题截图
If applicable, add screenshots to help explain your problem.

Don't show BDUSS and cookies.

如果可能,请附加问题截图。

不要出现 BDUSScookies

Envrionment / 运行环境

  • OS: [e.g. Windows]
  • Python [e.g. Python3.8]
  • BaiduPCS-Py Version [e.g. 0.6.9]

Runing log / 运行日志
Please follow steps to paste the content of file ~/.baidupcs-py/running.log.

  1. Remove the file ~/.baidupcs-py/running.log if it exists.
  2. Run the command where the bug occurs with envrionment variable LOG_LEVEL=DEBUG.
    e.g. LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. Paste the content of file ~/.baidupcs-py/running.log after the bug occurs.

Don't show BDUSS and cookies.

请按照下面的步骤贴出运行日志 ~/.baidupcs-py/running.log 中的内容。

  1. 删除 ~/.baidupcs-py/running.log,如果存在。
  2. 在问题发生的命令前加入环境变量 LOG_LEVEL=DEBUG
    例如:LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. 在问题出现后,贴出 ~/.baidupcs-py/running.log 中的内容。

不要出现 BDUSScookies

Additional context / 补充内容
Add any other context about the problem here.
在这里增加补充内容。

上传中按Ctrl-C中断,终端回显设置未复原(Linux)

Describe the bug / 描述 bug
上传中按 Ctrl-C 中断,终端回显功能被关闭,导致终端无法正常使用

To Reproduce / 复现问题

$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8

$ BaiduPCS-Py u test.mp4 /

⠹ test.mp4 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0% • 0.0/3.5 GB • ? • -:--:--

^c # 按 Ctrl-C 中断上传

$ stty # <- 这几个字并没有在屏幕上显示出来
speed 38400 baud; line = 0;
min = 1; time = 0;
-brkint -imaxbel iutf8
-icanon -echo

-echo表示终端回显功能被关闭,此时在终端输入任何内容都无法显示,但可以回车执行。如果需要恢复终端回显:

stty echo

Screenshots / 问题截图
N/A

Envrionment / 运行环境

  • OS: Linux Ubuntu 20.04
  • Python 3.8.5
  • BaiduPCS-Py v0.6.14

Runing log / 运行日志

2021-03-22 22:18:15,187 | DEBUG | upload: ======== Uploading start ========
-> Size of from_to_list: 0
2021-03-22 22:18:15,190 | DEBUG | upload: ======== Uploading end ========
2021-03-22 22:20:08,960 | DEBUG | upload: ======== Uploading start ========
-> Size of from_to_list: 1
2021-03-22 22:20:09,048 | DEBUG | upload: -> Upload: index: 0, task_id: 0
2021-03-22 22:20:10,704 | DEBUG | upload: `upload`: encrypt_type: EncryptType.No, localpath: test.mp4, remotepath, /test.mp4
2021-03-22 22:20:10,705 | DEBUG | upload: `upload`: encrypt_io_len: 3456805873
2021-03-22 22:20:10,705 | DEBUG | upload: `upload`: rapid_upload starts
2021-03-22 22:20:13,006 | DEBUG | app: `app`: handle_signal: 2

Additional context / 补充内容
N/A

有计划支持wap版分享链接吗

例如链接:https://pan.baidu.com/wap/init?surl=OOHZMcm-rUQA4piSgtWBiw 提取码:hmts

列出其他用户分享链接中的文件

BaiduPCS-Py listsharedpaths -p hmts http://pan.baidu.com/wap/init?surl=OOHZMcm-rUQA4piSgtWBiw
(v0.6.20) ERROR: BaiduPCSError: error_code: 105, message: 啊哦,链接错误没找到文件,请打开正确的分享链接

保存其他用户分享的链接

BaiduPCS-Py save -p hmts http://pan.baidu.com/wap/init?surl=OOHZMcm-rUQA4piSgtWBiw /
(v0.6.20) ERROR: BaiduPCSError: error_code: 105, message: 啊哦,链接错误没找到文件,请打开正确的分享链接

直接用浏览器打开这个分享链接后是手机版页面,输入正确的提取码并提交后跳转到新的网址:
https://pan.baidu.com/s/1OOHZMcm-rUQA4piSgtWBiw?dp-logid=20610200123498120001#list/path=%2F

这时候再用新的网址代替上面命令的WAP版链接就能正常工作:

BaiduPCS-Py listsharedpaths -p hmts https://pan.baidu.com/s/1OOHZMcm-rUQA4piSgtWBiw?dp-logid=20610200123498120001#list/path=%2F
Size Path
──────────────────────────────────────────────────────────────────────────
- 220.4 MB 231147936 /sharelink3378067569-108609370664595/WePE_64_V2.1.exe
- 194 B 194 /微PE工具箱/V2.1.1/WePE_64_V2.1.exe_MD5.txt

不知道有没有计划支持?

保存分享出错

感谢大佬分享这么给力的工具,辛苦。
我在用保存共享链接的时候遇到错误:
BaiduPCS-Py save -p s9vd https://pan.baidu.com/s/1adS0qazDDcDjx7NP_HNLJQ / ERROR: BaiduPCSError: BaiduPCS._request

尝试了几个链接都有这问题,谢谢

why mac compile failed

note: '__int128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_sigset_t; /* [???] signal set /
^
note: '__uint128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t __darwin_suseconds_t; /
[???] microseconds /
^
note: '__int128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_uid_t; /
[???] user IDs /
^
note: '__uint128_t' declared here
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_useconds_t; /
[???] microseconds */
^
note: '__uint128_t' declared here
In file included from baidupcs_py/common/simple_cipher.c:18:
In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:71:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t __darwin_wctype_t;
^
note: '__uint128_t' declared here
In file included from baidupcs_py/common/simple_cipher.c:18:
In file included from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:25:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h:64:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:75:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/_types/_va_list.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/machine/types.h:37:2: error: architecture not supported
#error architecture not supported
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
error: command 'clang' failed with exit status 1
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in
main()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/vendor/pep517/in_process.py", line 140, in build_wheel
return build_backend().build_wheel(wheel_directory, config_settings,
File "/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-build-env-41eu44xb/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
File "/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-build-env-41eu44xb/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 72, in make_in
wb.build()
File "/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-build-env-41eu44xb/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 103, in build
self.build(zip_file)
File "/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-build-env-41eu44xb/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 135, in build
self.run_build_command(setup)
File "/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-build-env-41eu44xb/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 163, in run_build_command
subprocess.check_call(
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Applications/Xcode.app/Contents/Developer/usr/bin/python3', '/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-install-36kjqky5/BaiduPCS-Py/setup.py', 'build', '-b', '/private/var/folders/f
/lx6ypd316dz0kzm313_gll1m0000gp/T/pip-install-36kjqky5/BaiduPCS-Py/build']' returned non-zero exit status 1.

ERROR: Failed building wheel for BaiduPCS-Py
Running setup.py clean for BaiduPCS-Py
Failed to build BaiduPCS-Py
Building wheels for collected packages: aget, mugen
Building wheel for aget (setup.py) ... done
Created wheel for aget: filename=aget-0.1.17-cp38-none-any.whl size=9379 sha256=353e3318496a52f508ceb1c82c7f12c975c040ae9a28368d6f04b1547edcd5eb
Stored in directory: /Users/wangbingquan/Library/Caches/pip/wheels/fd/c4/7f/833a8a4dc042055d182d84010df7f7ae270191ff1e490fcdbd
Building wheel for mugen (setup.py) ... done
Created wheel for mugen: filename=mugen-0.4.4-cp38-none-any.whl size=17426 sha256=a165194ce487380d3703b34789aabd22ae786c2fac9903d23ec470a82c7cf4d7
Stored in directory: /Users/wangbingquan/Library/Caches/pip/wheels/f0/48/db/51480b9b463c782997e781d130edb1fa8993d4be0b0d4eb575
Successfully built aget mugen
ERROR: Could not build wheels for BaiduPCS-Py which use PEP 517 and cannot be installed directly

下载速度很慢是怎么回事啊

我是SVIP,用百度客户端有15-18M每秒,但是用这个脚本不管是me还是aget_py都只有2M不到,是百度识别出了我不是用客户端限速了?

使用BaiduPCS-Py,分享文件时遇到错误

`
from baidupcs_py.baidupcs import BaiduPCSApi

api = BaiduPCSApi(bduss=bduss, cookies=cookies)

print(api.share('/997.zip'))
`

/usr/local/lib/python3.7/dist-packages/baidupcs_py/baidupcs/errors.py in check(*args, **kwargs)
148
149 if err:
--> 150 raise err
151 return info
152
BaiduPCSError: error_code: -6, message: 请重新登录

已经确定cookie中有STOKEN 值
在上传成功后,进行分享,但是会出现‘请重新登录’提示

运行不久链接被拒绝

我按照大佬的方法进行配置,开始正常运行了一段时间。之后就开始出错。

主要表现为上传文件显示检测文件已存在,列出文件列表提示出现错误(v0.6.8) System ERROR: 'list'。

[Feature request] 可以提供一个download_dir api 的同步版本吗?

download.download_dir(self.api,
        latest_file.path,
        download_path,
        recursive=True)

遇到一个需求,需要再将某个百度链接转存完以后做一些逻辑,当前的api 没有提供回调函数,或者同步的版本,可以麻烦作者提供一个相关的api吗?或者有没有什么好的解决的方法呢?

下载没速度

下载命令

(Baiduyun) ➜  test BaiduPCS-Py download ./1 -R -o ./ --no-decrypt
(v0.5.1) System ERROR: AutoDecryptRequest - Server does not support `Range` head
⠦ 1/图包.part1.rar.tmp ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0% • 0/100 bytes • ? • -:--:--

用户配置

(Baiduyun) ➜  samples BaiduPCS-Py ul
 Index   Recent   User Id      User Name   Quota           SVIP   VIP   pwd 
────────────────────────────────────────────────────────────────────────────
 1       ✔        3225735228   Mh00mg3     461.3 GB/6 TB   ✔      ✔     /   

某些用户存在Products中name为None条目,导致显示出问题

Describe the bug / 描述 bug
添加某用户后,BaiduPCS-Py userlist 输出 AttributeError: 'NoneType' object has no attribute 'startswith',其余用户管理指令(userdelsu)也无法使用

To Reproduce / 复现问题

  1. BaiduPCS-Py useradd ...
  2. BaiduPCS-Py userlist

Screenshots / 问题截图
N/A

Envrionment / 运行环境

  • OS: Linux Ubuntu 20.04
  • Python 3.8.5
  • BaiduPCS-Py v0.6.13

Runing log / 运行日志

2021-03-19 01:13:15,178 | DEBUG | app: `app`: System Error: Traceback (most recent call last):
  File "/home/alex/miniconda3/lib/python3.8/site-packages/baidupcs_py/app/app.py", line 101, in wrap
    return func(*args, **kwargs)
  File "/home/alex/miniconda3/lib/python3.8/site-packages/baidupcs_py/app/app.py", line 427, in userlist
    display_user_infos(*ls, recent_user_id=am._who)
  File "/home/alex/miniconda3/lib/python3.8/site-packages/baidupcs_py/commands/display.py", line 408, in display_user_infos
    if p.name.startswith("svip2_nd"):
AttributeError: 'NoneType' object has no attribute 'startswith'

Additional context / 补充内容
baidupcs_py/commands/display.pydisplay_user_infos

assert products
for p in products or []:
avail = str(datetime.timedelta(seconds=(int(p.end_time - time.time()))))
if p.name.startswith("svip2_nd"):
svip = f"Left [green]{avail}[/green]"
continue
if p.name.startswith("contentvip_nd"):
vip = f"Left [green]{avail}[/green]"
continue

>>> print(products)
[
    PcsUserProduct(name='offlinedl_permanent', start_time=1613264983, end_time=2147483648),
    PcsUserProduct(name=None, start_time=1615737599, end_time=1616342399),
    PcsUserProduct(name='svip2_nd', start_time=1615737599, end_time=1626278399),
    PcsUserProduct(name='contentvip_nd', start_time=1615737599, end_time=1626278399)
]

应该是第二项导致出错,临时解决方案是在407行插入

if p.name is None:
    continue

可以把隐藏空间添加进去吗

我利用大佬的api开发了一下百度网盘隐藏空间的功能,理论上只是多了一步二级密码的解锁,获取到一个SBOXTKN的cookie,通过这个cookie可以访问隐藏空间,我尝试利用pcs的目录接口发现没有权限打开隐藏空间,只能通过https://pan.baidu.com/api/list 这个接口实现。
这是我的demo
https://github.com/nvv5/BaiduSafeBox
实现了简单的隐藏空间文件展示,希望大佬能集成到你的项目里。

windows下出现编码问题

pip安装后,BaiduPCS-Py --help

Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\BaiduPCS-Py.exe\__main__.py", line 4, in <module>
  File "c:\programdata\anaconda3\lib\site-packages\baidupcs_py\app\__init__.py", line 2, in <module>
    from baidupcs_py.app.app import app as _app
  File "c:\programdata\anaconda3\lib\site-packages\baidupcs_py\app\app.py", line 49, in <module>
    from baidupcs_py.commands.server import start_server
  File "c:\programdata\anaconda3\lib\site-packages\baidupcs_py\commands\server.py", line 32, in <module>
    _html_tempt: Template = Template((Path(__file__).parent / "index.html").open().read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 16484: illegal multibyte sequence

PCS API Connection Reset

今天开始所有命令行功能都提示:

(v0.6.23) ERROR: BaiduPCSError: BaiduPCS._request
2021-07-09 18:34:05,155 | DEBUG | app: `app`: BaiduPCSError: Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/connection.py", line 411, in connect
    self.sock = ssl_wrap_socket(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 195, in _request
    resp = self._session.request(
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/app.py", line 117, in wrap
    return func(*args, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/app.py", line 463, in useradd
    account = Account.from_bduss(bduss, cookies=cookies)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/app/account.py", line 38, in from_bduss
    user = api.user_info()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/api.py", line 500, in user_info
    quota = self.quota()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/api.py", line 84, in quota
    info = self._baidupcs.quota()
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/errors.py", line 136, in check
    info = func(*args, **kwargs)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 223, in quota
    resp = self._request(Method.Get, url, params=params)
  File "/Users/cinvro/Library/Python/3.8/lib/python/site-packages/baidupcs_py/baidupcs/pcs.py", line 206, in _request
    raise BaiduPCSError("BaiduPCS._request", cause=err)
baidupcs_py.baidupcs.errors.BaiduPCSError: BaiduPCS._request

下载文件时报错PermissionError: [WinError 32]

首先感谢你们的代码,让我可以实现网盘文件同步功能。
Prerequisites / 报告前提
按照readme所给出的使用方法我进行操作。
Describe the bug / 描述 bug
在使用的过程中,成功的添加用户并能进行目录操作,但当我尝试使用 “BaiduPCS-Py download wordcount_v2.xlsx” 指令下载云盘文件时出现了权限错误问题:PermissionError: [WinError 32],详细内容内容如下
To Reproduce / 复现问题
1.添加用户,且使用 “BaiduPCS-Py who” 可以查看到正确的用户
2. 通过目录操作进入需要下载的文件目录
3. 使用 ”BaiduPCS-Py download wordcount_v2.xlsx“ 下载“wordcount_v2.xlsx"成功
4. 问题出现:
报错如下:
‘’‘
exception calling callback for <Future at 0x151e400e1d0 state=finished returned NoneType>
Traceback (most recent call last):
File "C:\Users\a8275\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 557, in move
os.rename(src, real_dst)
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'wordcount_v2.xlsx.tmp' -> 'wordcount_v2.xlsx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\a8275\AppData\Local\Programs\Python\Python37\lib\concurrent\futures_base.py", line 324, in _invoke_callbacks
callback(self)
File "c:\users\a8275\desktop\useless thing\computer network\socket\env\lib\site-packages\baidupcs_py\commands\download.py", line 159, in _wrap_done_callback
done_callback(fut)
File "c:\users\a8275\desktop\useless thing\computer network\socket\env\lib\site-packages\baidupcs_py\commands\download.py", line 77, in done_callback
shutil.move(localpath_tmp, localpath)
File "C:\Users\a8275\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 572, in move
os.unlink(src)
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'wordcount_v2.xlsx.tmp'
’‘’
错误截图
image

Envrionment / 运行环境

  • OS: Windows10
  • Python:Python3.7
  • BaiduPCS-Py Version:0.6.9

网盘登录需要每天登录

WARNNING: Please to search the similar bugs, before you report a bug. Don't report a similar bug which existed.
注意:在你提交一份报告前,请先搜索是否存在类似的报告。请勿重复提交内容相同的报告。

Prerequisites / 报告前提
Before you report a bug, please let the bug to be reproduced at the latest verion of BaiduPCS-Py.
在你提交报告前,请在 BaiduPCS-Py 的最新版本上复现问题。

At sometimes, there are errors occured by an expired cookie. Before you commit the report, please to check whether cookies are expired.
有时一些错误是由于某个 cookie 超期导致的。在你提交报告前,请先检查你的 cookies 是否超期。

Describe the bug / 描述 bug
A clear and concise description of what the bug is.
请清楚的描述你遇到的问题。

To Reproduce / 复现问题
Steps to reproduce the behavior:

  1. Do '...'
  2. Do '....'
  3. ...
  4. See error

按照下面的步骤可以复现问题:

  1. 做 '...'
  2. 做 '...'
  3. ...
  4. 问题出现

Screenshots / 问题截图
If applicable, add screenshots to help explain your problem.

Don't show BDUSS and cookies.

如果可能,请附加问题截图。

不要出现 BDUSScookies

Envrionment / 运行环境

  • OS: [e.g. Windows]
  • Python [e.g. Python3.8]
  • BaiduPCS-Py Version [e.g. 0.6.9]

Runing log / 运行日志
Please follow steps to paste the content of file ~/.baidupcs-py/running.log.

  1. Remove the file ~/.baidupcs-py/running.log if it exists.
  2. Run the command where the bug occurs with envrionment variable LOG_LEVEL=DEBUG.
    e.g. LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. Paste the content of file ~/.baidupcs-py/running.log after the bug occurs.

Don't show BDUSS and cookies.

请按照下面的步骤贴出运行日志 ~/.baidupcs-py/running.log 中的内容。

  1. 删除 ~/.baidupcs-py/running.log,如果存在。
  2. 在问题发生的命令前加入环境变量 LOG_LEVEL=DEBUG
    例如:LOG_LEVEL=DEBUG BaiduPCS-Py upload /abc /
  3. 在问题出现后,贴出 ~/.baidupcs-py/running.log 中的内容。

不要出现 BDUSScookies

Additional context / 补充内容
Add any other context about the problem here.
在这里增加补充内容。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.