sdvcrx / pan-baidu-download

百度网盘下载脚本
MIT License
436 stars 103 forks source link

Can't download files from Baidu anymore #32

Closed Kagami closed 8 years ago

Kagami commented 8 years ago

Hi. For some reason previously valid links now can't be downloaded with your tool. Example:

$ pan download http://pan.baidu.com/s/1eQxxdCI --secret 6hsh
Traceback (most recent call last):
  File "/home/kagami/.local/bin/pan", line 53, in <module>
    execute_command()
  File "/home/kagami/.local/bin/pan", line 49, in execute_command
    commands[command](args[1:])
  File "/home/kagami/code/tmp/pan-baidu-download/command/download.py", line 56, in download
    info = pan.get_dlink(url, secret)
  File "/home/kagami/code/tmp/pan-baidu-download/bddown_core.py", line 125, in get_dlink
    js = self._get_js(link, secret)
  File "/home/kagami/code/tmp/pan-baidu-download/bddown_core.py", line 116, in _get_js
    return js[0] or None
IndexError: list index out of range

Seems like Baidu has changed API?

sdvcrx commented 8 years ago

Please login first...

Seem Baidu did not allow downloading private link anonymously.

Open in Chrome private tab(Resource 404): screenshot_20160709_181847

After logged in: screenshot_20160709_182415

Kagami commented 8 years ago

Yes, I noticed the same, but it works after page reload. I think BAIDUID cookie is required? On the first visit there is no such cookie so baidu returns 403 and header Set-Cookie: BAIDUID=…. On the next visit I get normal page with secret input field.

sdvcrx commented 8 years ago

@Kagami interesting, I will fix it later

Kagami commented 8 years ago

Now it works, thanks!