Skip to content

直播:新接口适应性支持 - #189

Open
frostnotfall wants to merge 52 commits into
chen310:masterfrom
frostnotfall:master
Open

直播:新接口适应性支持#189
frostnotfall wants to merge 52 commits into
chen310:masterfrom
frostnotfall:master

Conversation

@frostnotfall

Copy link
Copy Markdown

直播 - 新接口适应性支持:

  1. 支持AVC, HEVC, AV1编码格式。
  2. 默认高帧率。
  3. 支持直播备份地址。
  4. 因为B站av1只在fmp4中提供,优先使用fmp4。小主播不提供fmp4,回退至ts。
    目前的小问题:
    画质选项中会出现HLS相关选项,貌似是potplayer特性。

…fmp4,回退至ts,支持直播备份地址,目前的小问题,画质选项中会出现HLS相关选项,貌似是potplayer特性。
Copilot AI lite review requested due to automatic review settings August 12, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 针对 Bilibili 直播播放解析切换到新版直播播放接口(getRoomPlayInfo),以适配更多编码/封装与备份地址输出,从而提升直播播放的兼容性与可选项。

Changes:

  • 新增直播画质映射(getLiveQuality),并在直播解析中基于新版 playurl_info 解析协议/封装/编码信息。
  • 直播流优先选择 fmp4,无 fmp4 时回退到 ts,并为主地址提供备份地址条目。
  • 直播画质列表按 codec(AVC/HEVC/AV1)分别生成对应 URL 与 itag。
Suppressed comments (1)

Media/PlayParse/MediaPlayParse - Bilibili.as:1791

  • 备份流的 itag 同样建议使用 getLiveItag(qn),保持与主流一致的排序/选择逻辑。
																						qualityItemBackup["itag"] = getItag(temp_codec["current_qn"].asInt()) * 100 + codecOffset * 10 + 1;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1602 to +1612
string getLiveQuality(int qn) {
if (qn == 30000) return "杜比";
if (qn == 20000) return "4K超高清";
if (qn == 15000) return "2K(原画)";
if (qn == 10000) return "1080p(原画)";
if (qn == 400) return "1080p(蓝光)";
if (qn == 250) return "720p(超清)";
if (qn == 150) return "480p(高清)";
if (qn == 80) return "360p(流畅)";
return "";
}
Comment on lines +1693 to +1701
string default_format_name = "";
for (int a = 0; a < formats.size(); a++) {
if (formats[a]["format_name"].asString() == "fmp4") {
default_format_name = "fmp4";
break;
} else if (formats[a]["format_name"].asString() == "ts") {
default_format_name = "ts";
}
JsonValue qyality_data = temp["data"]["durl"];
if (qyality_data.isArray()) {
qualityitem["url"] = qyality_data[0]["url"].asString();
if (qyality_data.size() > 1) {
qualityitem2["url"] = qyality_data[1]["url"].asString();
}
Comment on lines +1721 to +1729
int best_qn = 0;
for (int i = 0; i < accept_qnArray.size(); i++) {
int accept_qn = accept_qnArray[i];
if (best_qn < accept_qn) {
best_qn = accept_qn;
}
}

if (@QualityList !is null) {
Comment on lines +1730 to +1734
for (int i = 0; i < accept_qnArray.size(); i++) {
int accept_qn = accept_qnArray[i];
string quality_res = post("https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo?room_id=" + room_id
+ "&qn=" + accept_qn + "&codec=0,1,2&format=0,1,2&mask=0&no_playurl=0&platform=web&protocol=0,1");
JsonValue temp;
Comment on lines +1735 to +1742
if (Reader.parse(quality_res, temp) && temp.isObject()) {
if (temp["code"].asInt() != 0) {
continue;
}
}
JsonValue temp_streams = temp["data"]["playurl_info"]["playurl"]["stream"];
for (int ts = 0; ts < temp_streams.size(); ts++) {
string temp_protocol_name = temp_streams[ts]["protocol_name"].asString();
Comment on lines +1777 to +1779
if ( best_qn == temp_codec["current_qn"].asInt() ) {
url = temp_codec["url_info"][0]["host"].asString() + temp_codec["base_url"].asString() + temp_codec["url_info"][0]["extra"].asString();
}
qualityItemMain["url"] = temp_codec["url_info"][0]["host"].asString() + temp_codec["base_url"].asString() + temp_codec["url_info"][0]["extra"].asString();
qualityItemMain["quality"] = getLiveQuality(temp_codec["current_qn"].asInt()) + codec_suffix;
qualityItemMain["qualityDetail"] = qualityItemMain["quality"];
qualityItemMain["itag"] = getItag(temp_codec["current_qn"].asInt()) * 100 + codecOffset * 10;
李寒(Frost Lee)(lihan02) and others added 26 commits August 17, 2026 02:27
李寒(Frost Lee)(lihan02) and others added 25 commits September 2, 2026 18:06
- 整理代码结构。
- Wbi 签名增加wts参数。
- 缓存检查与存储去掉 wts与w_rid。
- 音频 itag 生成不再使用预定义。
- PGC 独立出来实现,已应对后续可能的变化。
- 修复特定类型用户合集。
2. 增加 potplayer 收发弹幕功能。
Updated installation instructions and removed outdated content related to previous login methods and features. Added links to relevant tutorials and clarified usage methods.
2. bugfix - 修复打开直播分区异常
2. 优化合集和分P名称显示
3. bugfix - 入站必刷变成历史记录
    - “我的动态”、"首页推荐"、"历史记录"、“综合热门”、个人“空间动态”,支持设定视频数量。
    - 从搜索和番剧媒体界面打开时,支持根据观看记录定位到当前观看的剧集(potplayer的观看记录)。
    - "我关注的直播间"当无人开播时,弹出对话框提醒。
    - 支持"综合热门"页面。
    - 增加"热门-排行榜-PGC"页面支持。
    - 搜索功能修复。
    - 增加UP主个人空间动态页面支持。
    - 各类生成的播放列表,日期基本上已全部显示。
    - 细节优化.

* MediaUrlList - Bilibili.as
    - "Potplayer - 打开链接",类别重新整理命名。
    - 排行榜适配B站新分区。
    - 增加 PGC 内容类别。

* 附带预生成播放列表文件
    按需使用,路径:{Potplayer 根目录}/Playlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants