Network error after login #244

Open
Soukyuu opened this Issue May 28, 2016 · 35 comments

Projects

None yet
@Soukyuu
Soukyuu commented May 28, 2016

Currently trying this out using the arch linux package. I'm getting a "network error" once I log in and clicking reload/any of the browsing categories. Profile info (space usage) does not load. Any idea what it could be?

@mytc
mytc commented May 30, 2016

我的也是,我是用ubuntu-mate. 看来百度修改了一些东西。

@bash-horatio

me too! At first, I guessed authentication of baidu has enhanced and actually it has.But I followed some steps to increase so-called security level, and still got this error. Now I don't know what the hell did baidu do!
bcloud

@mytc
mytc commented Jun 1, 2016

From the log, it shows that the error no is -6, which correspond to the error messages is bduss无效. Maybe it is the application token issue.

@licamla
licamla commented Jun 1, 2016 edited

百度在请求里增加了新的参数
logid=MTQ2NDc5NjE0NzYzMjAuMjg0NzcwNjM1MTU5Mjk4MzU=
用base64解码后14647961476320.28477063515929835
感觉跟时间有关系,但是具体怎么来的就不知道了。

根据 @poplite 提供的信息,logid并没有影响

@klaaswang

有解决办法没

@licamla
licamla commented Jun 2, 2016

cookie方面可能也改了

@xjgww
xjgww commented Jun 6, 2016

不懂,期待解决中。。。

@poplite
poplite commented Jun 6, 2016 edited

bcloud向API请求数据时漏了STOKENSCRC这两条Cookie.
还有bcloud在抓取Cookie时没有抓取SCRC这条Cookie.
现在测试成功的临时解决方案:
1.在auth.py的get_bdstoken函数的if req:前一行添加一句cookie.load_list(req.headers.get_all('Set-Cookie')),把SCRC加进cookie里去.
2.把pcs.py的所有函数中的cookie.sub_output()的参数添加上'SCRC','STOKEN',或者干脆把cookie.sub_output(xxx)都换成cookie.header_output().

这个临时解决方案很粗暴简单。。。希望作者尽快修复bug。

还有logid好像没有什么影响的说。。。

@mozbugbox

cookie 应该在 net.py 里使用 http.cookiejar 自动处理,而不应该到处传来传去,手动设定 set-cookie/cookie header. 手动处理容易出错。

import http.cookiejar, urllib.request
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
r = opener.open("http://example.com/")
@klaaswang

@poplite 不成功

@licamla licamla added a commit to licamla/bcloud that referenced this issue Jun 7, 2016
@licamla licamla fix network error
discuss on LiuLang#244
e8cce73
@poplite
poplite commented Jun 7, 2016

(⊙o⊙)?刚刚我在用,可以啊。

@licamla
licamla commented Jun 7, 2016

@poplite 可以用+1
@klaaswang 可能是看错,改了get_stoken吧(ps:我一开始就先看了这个函数,然后发现在这里改毫无意义)

@yfgeek
yfgeek commented Jun 8, 2016

@poplite 可以用 不错!

@programes

@poplite 可以使用

@solarisbin

@poplite 采用你的方法,我也可以列出网盘中的文件啦!感谢!

@sztsian sztsian added a commit to sztsian/repo that referenced this issue Jun 10, 2016
@sztsian sztsian fix network error LiuLang/bcloud#244 0184424
@8Niubility

你们讲的那些config files都在哪里呀?

@Meesingo

@poplite 修改好但是还是不能登陆
screenshot from 2016-06-11 22-48-59

@mytc
mytc commented Jun 13, 2016

@poplite , it works. But it seem the download still can't work. Is it happens to me only or others also has the same problem? Anyone here having the downloading issue after edited the files as @poplite suggested?

@Universebenzene

没有网络基础知识的小白表示临时解决方法的第一条就看不懂……

@tc0ct
tc0ct commented Jun 16, 2016

@mytc 我这边也是修改后解决了网络错误问题,但是还是不能够下载。下载任务状态都是ERROR。
查看了bcloud.log,有如下信息:

2016-06-16 22:07:24,515 WARNING Failed to get url to download
2016-06-16 22:07:36,488 ERROR pcs.get_download_link(): {'errno': -6, 'request_id': 3894584130341664361}

bcloud-stderr.log:

TypeError: <lambda>() takes 2 positional arguments but 4 were given
@poplite
poplite commented Jun 17, 2016

@mytc There are still some functions unchanged in @licamla 's patch.
Here is my patch that can fix the downloading issue and the other issues.

auth.py:

*** auth.py 2016-01-02 15:47:21.000000000 +0800
--- auth_new.py 2016-06-17 17:39:16.057669144 +0800
***************
*** 289,294 ****
--- 289,295 ----
      '''
      url = const.PAN_REFERER
      req = net.urlopen(url, headers={'Cookie': cookie.header_output()})
+     cookie.load_list(req.headers.get_all('Set-Cookie')) # SCRC
      if req:
          return parse_bdstoken(req.data.decode())
      else:

pcs.py:

*** pcs.py  2016-01-02 15:47:21.000000000 +0800
--- pcs_new.py  2016-06-17 17:38:52.909669250 +0800
***************
*** 542,548 ****
      ])
      req = net.urlopen(url, headers={
          'Content-type': const.CONTENT_FORM_UTF8,
!         'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'PANWEB', 'cflag'),
      })
      if req:
          content = req.data
--- 542,548 ----
      ])
      req = net.urlopen(url, headers={
          'Content-type': const.CONTENT_FORM_UTF8,
!         'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'PANWEB', 'cflag','SCRC','STOKEN'),
      })
      if req:
          content = req.data
***************
*** 717,723 ****
      dlink = metas['info'][0]['dlink']
      url = '{0}&cflg={1}'.format(dlink, cookie.get('cflag').value)
      req = net.urlopen_without_redirect(url, headers={
!         'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'cflag'),
          'Accept': const.ACCEPT_HTML,
      })
      if not req:
--- 717,723 ----
      dlink = metas['info'][0]['dlink']
      url = '{0}&cflg={1}'.format(dlink, cookie.get('cflag').value)
      req = net.urlopen_without_redirect(url, headers={
!         'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'cflag','SCRC','STOKEN'),
          'Accept': const.ACCEPT_HTML,
      })
      if not req:
***************
*** 907,913 ****
          data = ('dlink=0&target=' +
                  encoder.encode_uri_component(json.dumps(filelist)))
      req = net.urlopen(url, headers={
!         'Cookie': cookie.sub_output('BDUSS'),
          'Content-type': const.CONTENT_FORM,
          }, data=data.encode())
      if req:
--- 907,913 ----
          data = ('dlink=0&target=' +
                  encoder.encode_uri_component(json.dumps(filelist)))
      req = net.urlopen(url, headers={
!         'Cookie': cookie.sub_output('BDUSS','SCRC','STOKEN'),
          'Content-type': const.CONTENT_FORM,
          }, data=data.encode())
      if req:
@licamla
licamla commented Jun 17, 2016

@poplite, it works.thinks!

@mytc
mytc commented Jun 18, 2016

@poplite , Yeah it works!! Appreciate it very much.
By the way, do you where can get this Baidu cloud api documentation?
I maybe will develop my own version of desktop app, if I have the spare time.

@poplite
poplite commented Jun 19, 2016 edited

@mytc The api isn't officially offered by Baidu.It comes from the web client(http://pan.baidu.com). We have to get it manually by using wireshark or Chromium Devtools.
If you want to develop your own version of bcloud,see #41 and #178.

@mytc
mytc commented Jun 20, 2016

@poplite , thanks!

@Meesingo

I still can't login, maybe because I have to input a captcha when logging in. I suppose there may be some issues going on with dealing captchas as well.

@yan12125

@poplite's patch at #244 (comment) fixes my problem, too. Anyone going to create a pull request?

@yan12125 yan12125 added a commit to yan12125/bcloud that referenced this issue Jun 30, 2016
@yan12125 yan12125 Fix "Network error" after login
The patch is proposed by @poplite at
LiuLang#244 (comment)

Closes #244, closes #247
b50d2ce
@yan12125

I've pushed @poplite's patch to #248.

@wonderful60

@Meesingo 你的ubuntu用的什么主题,怎么这么漂亮

@licamla licamla added a commit to licamla/bcloud that referenced this issue Jul 15, 2016
@licamla licamla fix network error and download error
patched by @poplite
discuss on LiuLang#244
5b3d38a
@Meesingo
Meesingo commented Jul 17, 2016 edited

@wonderful60 theme是arc-darker 我改了一下左上角的三个按钮的大小

@Meesingo

The captcha verification worked after clearing configs, caches, and captcha images downloaded

@tainzhi
tainzhi commented Aug 4, 2016

@poplite, thanks. it works well!
I just copy the patch to a.patch, b.patch,
then go to the directory
/usr/lib/python3/dist-packages/bcloud

cp auth.py auth.py.backup
cp pcs.py pcs.py.backup
patch auth.py < auth.patch
patch pcs.py < pcs.patch

The last step,
rm ~/.config/bcloud -rf

@sorrowchen

Still works!

@yinflying
yinflying commented Jan 11, 2017 edited

仍然可用,所以我fork一份,并将deb的打上补丁并打包了
ubuntu/debian 可以直接试用一下:
https://github.com/yinflying/bcloud-packages

@bash-horatio

@yinflying 今天试了一下,并不行~
直接从终端启动的bcloud-gui,输入了正确的验证码后,还是停在登录小窗。终端也没有什么错误信息……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment