Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

tychxn/baidu-wangpan-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

百度网盘分享文件下载链接解析

version status license star, issue

功能

  • 获取百度网盘分享文件的真实下载地址
  • 将获取到的下载链接复制到IDMFDM等下载器即可实现高速下载,避免使用百度网盘客户端

运行环境

  • Python3 (兼容Python2)

第三方库

使用帮助

$ python baidu_wangpan_parse.py -h
usage: baidu_wangpan_parse.py [-h] [-f] link [password]

Get Baidu wangpan sharing file download link.

positional arguments:
  link          Baidu wangpan sharing file link
  password      Baidu wangpan sharing file password

optional arguments:
  -h, --help    show this help message and exit
  -f, --folder  if sharing file is a folder

注意事项

  • 【2018.11.09】增加百度账号登陆功能,可以获取到下载链接。但是下载也需要附上登陆cookie,等待后续更新。
  • 【2018.10.16】百度网盘更新,需要用户登陆才能获取下载链接,代码暂时失效,等待后续更新。
  • 【2018.10.03】百度网盘最近限制了打包下载,当选择的多个文件大于300M时会提示{"error_code":31090,"error_msg":"package is too large","request_id":8704138921699374750}。因此无法下载过大的文件夹,单个文件下载不受影响。

使用实例

下载安装:

git clone https://github.com/tychxn/baidu-wangpan-parse
cd baidu-wangpan-parse
pip install -r requirements.txt

config.ini文件中配置账号密码:

[account]
username = your_username
password = your_password

1.获取没有加密单个文件的下载地址:

$ python main.py https://pan.baidu.com/s/1dG1NCeH
http://d.pcs.baidu.com/file/8192bee674d4fa51327b4fcd48419527?fid=271812880-250528-1043814616287203&dstime=1529692196&rt=sh&sign=FDtAERV-DCb740ccc5511e5e8fedcff06b081203-X4Fh%2FqJm8VsmmFSfxrvr0Xi%2BWuo%3D&expires=8h&chkv=1&chkbd=0&chkpc=&dp-logid=556008995005344418&dp-callid=0&r=913049239

2.获取加密单个文件的下载地址:

$ python main.py https://pan.baidu.com/s/1qZbIVP6 xa27
http://d.pcs.baidu.com/file/db0be336c157d7cd2e1368c7a80833d6?fid=1708072416-250528-674694471059199&dstime=1529692222&rt=sh&sign=FDtAERV-DCb740ccc5511e5e8fedcff06b081203-elkzjwahMSEUGaVYSsBWYDt9y9I%3D&expires=8h&chkv=1&chkbd=0&chkpc=&dp-logid=556015960669176024&dp-callid=0&r=457285671

3.获取没有加密文件夹的打包下载地址(小于300M)

$ python main.py -f https://pan.baidu.com/s/1hIm_wG-LtGPYQ3lY2ANvxQ
https://www.baidupcs.com/rest/2.0/pcs/file?method=batchdownload&app_id=250528&zipcontent=%7B%22fs_id%22%3A%5B%22680498123896117%22%5D%7D&sign=DCb740ccc5511e5e8fedcff06b081203:T%2BfekNxcAnRRurxsKdpdzYxHnDk%3D&uid=1708072416&time=1538662289&dp-logid=8705314671792360782&dp-callid=0&shareid=610414498&from_uk=1708072416

4.获取加密文件夹的打包下载地址(小于300M)

$ python main.py -f https://pan.baidu.com/s/1htWjWk0 5ykw
https://www.baidupcs.com/rest/2.0/pcs/file?method=batchdownload&app_id=250528&zipcontent=%7B%22fs_id%22%3A%5B%22680498123896117%22%5D%7D&sign=DCb740ccc5511e5e8fedcff06b081203:7w%2BgJ2pcVqrLf4AF9rb9N1Z4hDI%3D&uid=1708072416&time=1538661815&dp-logid=8705187263682751022&dp-callid=0&shareid=185984296&from_uk=1708072416

常见问题

文件打包下载后解压时提示头部错误, 解压失败。这个问题多发于7-Zip解压,换用WinRAR即可解压成功。

错误代码

Errno 含义
0 成功
-1 您下载的内容中包含违规信息
-20 显示验证码
2 下载失败,请稍候重试
113 页面已过期
116 该分享不存在
118 没有下载权限
121 你选择操作的文件过多,减点试试吧

待办列表

  • 解析文件夹的下载地址同时获取zip压缩包名字以及大小

备注

  • 当前测试时间2018.11.09。如果失效,请在issue中提出,我会来更新。

About

获取百度网盘分享文件的下载地址

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages