Comments (6)
基本找到临时解决方案了, 虽然修改了一下代码, 但目前的方案还不确定是否可以长期有效。
API请求带了w_rid这个散列值, 用的是MD5算法, 是把querystring排序后, 拼接上一个token, 然后MD5产生的。
token的生成算法也提取出来了, 但是有2个入参key还不确定是怎么来的, 虽然现在的b站并没有使用动态key, 每次发出来的请求, token都是一样的。
我使用一段时间再来回复这个方案是否可行。
from bilix.
感谢提醒,大致看了一下那个项目的代码,应该能够一劳永逸的解决这个问题,key是从另一个api接口获取的。
我照样子去修改一下。
btw:我不懂python,代码pr后,你可以自己看看怎么优化。
python代码都是让ai帮我从js转为py的
from bilix.
修改过的get_up_info方法, 只是加了2个warn输出
@raise_api_error
async def get_up_info(client: httpx.AsyncClient, url_or_mid: str, pn=1, ps=30, order='pubdate', keyword=''):
"""
获取up主信息
:param url_or_mid:
:param pn:
:param ps:
:param order:
:param keyword:
:param client:
:return:
"""
if url_or_mid.startswith('http'):
mid = re.findall(r'/(\d+)', url_or_mid)[0]
else:
mid = url_or_mid
params = {'mid': mid, 'order': order, 'ps': ps, 'pn': pn, 'keyword': keyword}
#日志输出params的内容
logging.warn(f"参数,{params}")
res = await req_retry(client, 'https://api.bilibili.com/x/space/wbi/arc/search', params=params)
info = json.loads(res.text)
logging.warn(f"返回值:{info}")
up_name = info['data']['list']['vlist'][0]['author']
total_size = info['data']['page']['count']
bv_ids = [i['bvid'] for i in info['data']['list']['vlist']]
return up_name, total_size, bv_ids
from bilix.
b站api有变动,等待后续修复
from bilix.
各位如果自己有能力调整的,也欢迎PR
from bilix.
@yushiro 我看到有开发者也解决了这个问题,如bilicope,如果稳定运行欢迎PR
from bilix.
Related Issues (20)
- 请求添加自定义输出文件名的功能 HOT 2
- 使用get_up获取某个up的所有投稿视频的时候,可能会获取到已经失效的视频?然后get_video_info就会发生报错?
- ImportError due to deprecated 'cgi' module in Python 3.13
- 0.18.6 regression test failure HOT 6
- api错误 HOT 1
- 报错
- 报错 HOT 2
- bilix.exception.APIParseError: APIParseError Caused by KeyError in <bilix.sites.bilibili.api:get_up_video_info> HOT 1
- python和vc++都是最新的,为啥报错 HOT 2
- Specify profile directory with from-browser
- Python 调用如何使用cookie? HOT 1
- bilix0.18.8执行报错 HOT 4
- mac下载的视频文件只有音频,没有画面 HOT 4
- 下载b站视频合集时,raise EndOfStream from None
- New feat: BaseDownloader can switch to faster url when provided multiple urls for same resource
- 请问可以通过api接口的形式访问吗 HOT 8
- 下载收藏夹视频报错:Can't find any handler for method: 'get_favour' keys HOT 2
- Documents URL Link not working HOT 1
- [增加]按照UP主的文字分类存放
- 【bilix get_up 】KeyError: 'list' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bilix.