Nemo2011 / bilibili-api

哔哩哔哩常用API调用。支持视频、番剧、用户、频道、音频等功能。原仓库地址:https://github.com/MoyuScript/bilibili-api
https://nemo2011.github.io/bilibili-api/
GNU General Public License v3.0
2.19k stars 210 forks source link

[漏洞] 无法刷新token #592

Closed Marrylatiao closed 10 months ago

Marrylatiao commented 11 months ago

Python 版本: 3.10.13

模块版本: 16.1.1

运行环境: MacOS

模块路径: bilibili_api.credential

解释器: cpython / pypi / jython

报错信息:

  File "/python3.10/site-packages/bilibili_api/credential.py", line 51, in refresh
    new_cred: Credential = await refresh_cookies(self)
  File "/python3.10/site-packages/bilibili_api/credential.py", line 144, in refresh_cookies
    refresh_csrf = await get_refresh_csrf(credential)
  File "/python3.10/site-packages/bilibili_api/credential.py", line 128, in get_refresh_csrf
    raise Exception("获取刷新 Cookies 的 csrf 失败。")
Exception: 获取刷新 Cookies 的 csrf 失败。

构造的token信息包含这些,按照文档说明应该是可以刷新token, 但是刷新会报错

credential = Credential(
    sessdata="xxx",
    bili_jct="xxx",
    buvid3="xxx",
    dedeuserid="xxx",
    ac_time_value="xxx")
TZFC commented 11 months ago

dev分支也有错误,从今天开始出现的 ··· new_cred: Credential = await refresh_cookies(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.../python3.11/site-packages/bilibili_api_python-16.1.1-py3.11.egg/bilibili_api/credential.py", line 156, in refresh_cookies raise Exception("刷新 Cookies 失败") Exception: 刷新 Cookies 失败 ···

TZFC commented 11 months ago

Python 版本: 3.10.13

模块版本: 16.1.1

运行环境: MacOS

模块路径: bilibili_api.credential

解释器: cpython / pypi / jython

报错信息:

  File "/python3.10/site-packages/bilibili_api/credential.py", line 51, in refresh
    new_cred: Credential = await refresh_cookies(self)
  File "/python3.10/site-packages/bilibili_api/credential.py", line 144, in refresh_cookies
    refresh_csrf = await get_refresh_csrf(credential)
  File "/python3.10/site-packages/bilibili_api/credential.py", line 128, in get_refresh_csrf
    raise Exception("获取刷新 Cookies 的 csrf 失败。")
Exception: 获取刷新 Cookies 的 csrf 失败。

构造的token信息包含这些,按照文档说明应该是可以刷新token, 但是刷新会报错

credential = Credential(
    sessdata="xxx",
    bili_jct="xxx",
    buvid3="xxx",
    dedeuserid="xxx",
    ac_time_value="xxx")

这个报错曾经可以使用dev分支解决,但今天开始dev版本有了另一个报错

blyc commented 11 months ago

https://github.com/Nemo2011/bilibili-api/pull/593/files

可否测试下根据该提交增加headers后是否修复

TZFC commented 11 months ago

修复了,感谢!另:import 的时候报错syntax error. bilibili_api/ass.py 196行少了半个括号

cid = await v._Video__get_cid_by_index(page)
z0z0r4 commented 11 months ago

修复了,感谢!另:import 的时候报错syntax error. bilibili_api/ass.py 196行少了半个括号

cid = await v._Video__get_cid_by_index(page)

dev 分支没看到,哪缺了?

https://github.com/Nemo2011/bilibili-api/blob/11c33b16003f3111684421fb9ad4cbea5833ef18/bilibili_api/ass.py#L196

了解了 https://github.com/Nemo2011/bilibili-api/commit/149ac726c94cc68cfac780d5000cd93c79a292bb

z0z0r4 commented 11 months ago

pip install bilibili-api-dev --upgrade