【解决】bcloud百度云获取bdstoken失败该怎么解决?
Tofloor
poster avatar
a2035274
deepin
2016-09-15 18:45
Author
本帖最后由 a2035274 于 2017-2-6 21:39 编辑

2017-01-28提问,bcloud再次无法使用问题出在:
未绑手机号的百度会提示 “ 绑定手机号”
已绑手机号的百度会提示   “手机号变更”

根据
https://gist.github.com/poplite/72f76df4f9d9f1622f73b786937fe389
修改后,已可以使用



方法在17#

也可以先安装bcloud_3.8.2-4.tar.gz 后直接用附件中bcloud.tar.gz的三个文件替换后
清除~./cache/bcloud    ~./config/bcloud

再次登陆并输入验证就可以使用了


Reply Favorite View the author
All Replies
avatar
lixiaobai
deepin
2016-09-18 22:21
#1
我也遇到这个问题,现在没法登陆了。
Reply View the author
avatar
方块8
deepin
2016-09-19 04:10
#2
今天登陆也发现这个问题了,然后翻看了 bcloud 源码,发现出现这个问题主要是 作者对验证码的长度进行了判断,如果长度小于4的话什么都不做,而汉字验证码的长度为2,具体代码看/usr/lib/python3/dist-packages/bcloud/SigninDialog.py 的 111 行( if len(self.vcode_entry.get_text()) == 4 ),我的做法是出现中文验证码时随便输入4个字符,然后提交,之后提示验证码错误,然后再次点登陆后弹出的就是4个英文字母的验证码了,这时输入正确的验证码就能登陆了
Reply View the author
avatar
redapple0204
deepin
2016-09-19 04:11
#3
http://tieba.baidu.com/p/4784886012
Reply View the author
avatar
李逍遥mx
deepin
2016-09-19 05:38
#4
本帖最后由 lrbmfx 于 2016-9-18 21:39 编辑

弃坑吧,bcloude已废~~~
Reply View the author
avatar
15******06@sina.cn
deepin
2016-09-20 00:06
#5
https://bbs.deepin.org/post/43445
弃坑吧,bcloude已废~~~

已经有人接手了好吧,而且按照要求来修改依然可用
Reply View the author
avatar
a2035274
deepin
2016-09-21 16:38
#6
https://bbs.deepin.org/post/43445
今天登陆也发现这个问题了,然后翻看了 bcloud 源码,发现出现这个问题主要是 作者对验证码的长度进行了判 ...

谢谢,用你的办法已成功登陆。
Reply View the author
avatar
a2035274
deepin
2017-01-28 19:45
#7
本帖最后由 a2035274 于 2017-2-6 21:39 编辑

试过了 阿柏奇 大神制做的 bcloud_3.8.2-4_all 包仍然不能用 所以再次求助

https://github.com/Yufeikang

仍有维护 但也是两个月前的

一个Linux下的百度网盘客户端
https://bbs.deepin.org/post/42600

以前试过编译 不过没能成功 现在仍在开发中

Reply View the author
avatar
4***8@qq.com
deepin
2017-01-28 20:06
#8
a2035274 发表于 2017-1-28 11:45
试过了 阿柏奇 大神制做的 bcloud_3.8.2-4_all 包仍然不能用 所以再次求助

https://github.com/Yufeikang

我也试了他的这个版本,确实也是不行了啊。
Reply View the author
avatar
随风
deepin
2017-01-28 20:07
#9
期待有好的解决办法。
Reply View the author
avatar
a2035274
deepin
2017-01-28 20:26
#10
本帖最后由 a2035274 于 2017-2-6 21:39 编辑
https://bbs.deepin.org/post/43445
期待有好的解决办法。

Aria2 - 可能是现在下载百度云资料速度最快的方式  http://www.jianshu.com/p/e5e56a1d25a3
教你使用正确姿势来下载百度云大文件 https://bbs.deepin.org/post/42503

参考这两个贴子,到是可以下载了。


安装使用只需四个步骤:
  • 下载并安装Google Chrome插件BaiduExporter
  • 下载并安装Aria2GUI程序, 并打开程序 前两步参考 《Aria2 - 可能是现在下载百度云资料速度最快的方式》  解压aria2gui-master复制public_zh到任意目录并用chrom打开public_zh中的index.html
  • 下载并安装Aria2 参考《教你使用正确姿势来下载百度云大文件》
  • 打开或刷新百度云资料的页面, 选中资料并点击下载

Reply View the author
avatar
随风
deepin
2017-01-29 03:47
#11
https://bbs.deepin.org/post/43445
Aria2 - 可能是现在下载百度云资料速度最快的方式  http://www.jianshu.com/p/e5e56a1d25a3
教你使用正确 ...

学习了,非常感谢!
Reply View the author
avatar
130******98
deepin
2017-01-29 06:13
#12
https://bbs.deepin.org/post/43445
试过了 阿柏奇 大神制做的 bcloud_3.8.2-4_all 包仍然不能用 所以再次求助

https://github.com/Yufeikang

阿柏奇 大神制做的 bcloud_3.8.2-4_all 刚放出来的时候是可以用的,没过几天就不能用了
Reply View the author
avatar
callmelanlan
deepin
2017-01-30 03:13
#13
bcloud验证码错误显示只有两个汉字。(正常验证码是四位的)

修复bug:sudo gedit /usr/lib/python3/dist-packages/bcloud/SigninDialog.py

把第316行的tokens['token']改为tokens
Reply View the author
Comments
a2035274
2017-02-05 18:05
修复汉字验证的方法就是这个
avatar
duanchi
deepin
2017-01-30 03:33
#14
哎…我也发现了,后来我实在受不鸟了,用了pcs命令了,至今还好。哎…绕不开的命令
Reply View the author
Comments
a2035274
2017-02-05 18:06
学习了
avatar
a2035274
deepin
2017-02-05 15:55
#15
https://bbs.deepin.org/post/43445
bcloud验证码错误显示只有两个汉字。(正常验证码是四位的)

修复bug:sudo gedit /usr/lib/python3/dist-pa ...

不好意思,应该修改大标题了,应该问     bcloud百度云获取bdstoken失败该怎么解决?
Reply View the author
avatar
a2035274
deepin
2017-02-05 16:59
#16
本帖最后由 a2035274 于 2017-2-5 10:00 编辑

bcloud百度云获取bdstoken失败   根据https://gist.github.com/poplite/72f76df4f9d9f1622f73b786937fe389已解决
步骤:
1、安装  阿柏奇 大神制做的 bcloud_3.8.2-4_all   https://pan.baidu.com/s/1nvo8qnB
2、sudo gedit /usr/lib/python3/dist-packages/bcloud/SigninDialog.py
3、sudo gedit /usr/lib/python3/dist-packages/bcloud/auth.py
4、sudo gedit /usr/lib/python3/dist-packages/bcloud/const.py
bcloud.tar.gz
  1. diff --git a/bcloud/SigninDialog.py b/bcloud/SigninDialog.py
  2. index f38c03d..939f6fd 100644
  3. --- a/bcloud/SigninDialog.py
  4. +++ b/bcloud/SigninDialog.py
  5. @@ -293,6 +293,18 @@ class SigninDialog(Gtk.Dialog):
  6.                  self.update_profile(username, password, cookie, tokens,
  7.                                      dump=True)

  8. +        def on_get_access_cookie(info, error=None):
  9. +            if error or not info:
  10. +                logger.error('SigninDialog.on_get_access_cookie: %s, %s' %
  11. +                             (info, error))
  12. +              # self.signin_failed(
  13. +              #         _('Fail to get access cookie, please try again'))
  14. +            else:
  15. +                cookie.load_list(info)
  16. +                self.signin_button.set_label(_('Get bdstoken...'))
  17. +                gutil.async_call(auth.get_bdstoken, cookie,
  18. +                                 callback=on_get_bdstoken)
  19. +
  20.          def on_post_login(info, error=None):
  21.              if error or not info:
  22.                  logger.error('SigninDialog.on_post_login: %s, %s' %
  23. @@ -303,9 +315,9 @@ class SigninDialog(Gtk.Dialog):
  24.                  errno, query = info
  25.                  if errno == 0:
  26.                      cookie.load_list(query)
  27. -                    self.signin_button.set_label(_('Get bdstoken...'))
  28. -                    gutil.async_call(auth.get_bdstoken, cookie,
  29. -                                     callback=on_get_bdstoken)
  30. +                  # self.signin_button.set_label(_('Get access cookie...'))
  31. +                    gutil.async_call(auth.get_access_cookie, cookie, callback=on_get_access_cookie)
  32. +
  33.                  # 257: 需要输入验证码
  34.                  elif errno == 257:
  35.                      nonlocal verifycode
  36. diff --git a/bcloud/auth.py b/bcloud/auth.py
  37. index 602d5d4..9f7b806 100644
  38. --- a/bcloud/auth.py
  39. +++ b/bcloud/auth.py
  40. @@ -267,6 +267,35 @@ def post_login(cookie, tokens, username, password, rsakey, verifycode='',
  41.          return (-1, None)
  42.      return (-1, None)

  43. +def get_access_cookie(cookie):
  44. +    '''通过重定向获取验证cookie
  45. +   
  46. +    重定向的链接开头为:
  47. +    http://pan.baidu.com/disk/home?errno=0&errmsg=Auth%20Login%20Sucess&stoken=
  48. +    '''
  49. +    url = ''.join([
  50. +        const.PASSPORT_LOGIN_V3,
  51. +        'auth/?return_type=5',
  52. +        '&tpl=netdisk&u=http%3A%2F%2Fpan.baidu.com%2Fdisk%2Fhome'
  53. +    ])
  54. +    headers={
  55. +        'Cookie': cookie.header_output(),
  56. +        'Referer': const.PAN_REFERER,
  57. +    }
  58. +    req = net.urlopen_without_redirect(url, headers=headers)
  59. +    if req:
  60. +        if req.headers.get_all("Location"):
  61. +            redirect_url = req.headers.get_all("Location")[0]
  62. +            redirect_req = net.urlopen_without_redirect(redirect_url, headers={'Cookie': cookie.header_output()})
  63. +            if redirect_req:
  64. +                return redirect_req.headers.get_all('Set-Cookie')
  65. +            else:
  66. +                return None
  67. +        else:
  68. +            return None
  69. +    else:
  70. +        return None
  71. +
  72. def parse_bdstoken(content):
  73.      '''从页面中解析出bdstoken等信息.
  74.      
  75. diff --git a/bcloud/const.py b/bcloud/const.py
  76. index 85c2761..8c50dbe 100644
  77. --- a/bcloud/const.py
  78. +++ b/bcloud/const.py
  79. @@ -15,6 +15,7 @@ BAIDU_URL = 'http://www.baidu.com/'
  80. PASSPORT_BASE = 'https://passport.baidu.com/'
  81. PASSPORT_URL = PASSPORT_BASE + 'v2/api/'
  82. PASSPORT_LOGIN = PASSPORT_BASE + 'v2/api/?login'
  83. +PASSPORT_LOGIN_V3 = PASSPORT_BASE + 'v3/login/api/'
  84. REFERER = PASSPORT_BASE + 'v2/?login'
  85. #USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0'
  86. USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0'
Copy the Code


Reply View the author