GithubHelp home page GithubHelp logo

peterding / baidupcs-py Goto Github PK

View Code? Open in Web Editor NEW
673.0 12.0 109.0 1.23 MB

BaiduPCS API & App 百度网盘客户端 和 API

License: MIT License

Python 93.58% Makefile 0.10% HTML 5.94% Cython 0.39%
baidu baidupcs baidu-api baiducloud baidupan baiduyun

baidupcs-py's Issues

保存分享出错

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

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

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

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

MACOS 无法贴入 Cookie

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

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

网盘登录需要每天登录

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.
在这里增加补充内容。

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

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

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

转存分享链接报错 (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

下载没速度

下载命令

(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   ✔      ✔     /   

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

运行不久链接被拒绝

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

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

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

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

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

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

建议增加 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.
在这里增加补充内容。

下载速度最多 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 ;后者是使用者输入账号和密码,程序模拟登陆后获取登录信息。不知道问题是否跟这个有关?

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

您好,

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

感谢。

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.
在这里增加补充内容。

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

上传中按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

不知道有没有计划支持?

下载时,没有反应

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.
在这里增加补充内容。

开启server 是否限速了

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

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

下载文件时报错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

一直无法在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折腾很久无法安装,非常难受

异地登录限制

作者你好!感谢开发这么完善的库。我遇到的问题是在挂美国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登陆都没有问题)。非常感谢!

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

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

System ERROR: AutoDecryptRequest - Request Error

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

使用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 值
在上传成功后,进行分享,但是会出现‘请重新登录’提示

[已解决] 关于在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。运行时的权限也没有问题。

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

无法使用 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 文件为空。

某些用户存在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

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.