HFrost0 / bilix

⚡️Lightning-fast async download tool for bilibili and more
Apache License 2.0
1.64k stars 168 forks source link

improve hdr support #82

Closed cncws closed 1 year ago

cncws commented 1 year ago

部分视频探测不到 HDR 清晰度,见问题 https://github.com/HFrost0/bilix/issues/81

请求网页时即使带上大会员的 SESSDATA,默认也不返回 HDR 清晰度的选项,因此你的 info 命令解析不到。在加上 Cookie CURRENT_FNVAL=4048 之后,返回的页面中就有了 HDR 选项。(4048是浏览器正常访问页面时携带的值,理论上可以覆盖到 8K 分辨率)

本次 PR 增强了获取 HDR 视频的能力。

pytest 结果如下:

% pytest tests/api/test_bilibili_api.py
================================================= test session starts =================================================
platform darwin -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0
rootdir: /Users/cws/Documents/GitHub/bilix
plugins: asyncio-0.20.3, anyio-3.6.2
asyncio: mode=strict
collected 9 items                                                                                                     

tests/api/test_bilibili_api.py .........                                                                        [100%]

================================================== 9 passed in 3.61s ==================================================
HFrost0 commented 1 year ago

加了之后确实可以获取到hdr的信息。但是我试了一下我的浏览器,虽然里面有CURRENT_FNVAL=4048,但是网页却不显示hdr的选项

截屏2022-12-26 10 18 57
cncws commented 1 year ago

文档可以参考这里 https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/video/videostream_url.md#fnval视频流格式标识 含义是一样的,在网页上切换清晰度,调用的就是这个接口