Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复一些解析问题 #776

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions BBDown.Core/AppHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ public static async Task<string> DoReqAsync(string aid, string cid, string epId,

var headers = GetHeader(appkey);
LogDebug("App-Req-Headers: {0}", JsonSerializer.Serialize(headers, JsonContext.Default.DictionaryStringString));
byte[] body, data;
byte[] data;
// 只有pgc接口才有配音和片头尾信息
if (bangumi)
{
body = GetPayload(Convert.ToInt64(epId), Convert.ToInt64(cid), Convert.ToInt64(qn), GetVideoCodeType(encoding));
if (!(string.IsNullOrEmpty(encoding) || encoding == "HEVC"))
LogWarn("APP的番剧不支持 HEVC 以外的编码");
var body = GetPayload(Convert.ToInt64(epId), Convert.ToInt64(cid), Convert.ToInt64(qn), PlayViewReq.Types.CodeType.Code265);
data = await GetPostResponseAsync(API2, body, headers);
}
else
{
body = GetPayload(Convert.ToInt64(aid), Convert.ToInt64(cid), Convert.ToInt64(qn), GetVideoCodeType(encoding));
var body = GetPayload(Convert.ToInt64(aid), Convert.ToInt64(cid), Convert.ToInt64(qn), GetVideoCodeType(encoding));
data = await GetPostResponseAsync(API, body, headers);
}
var resp = new MessageParser<PlayViewReply>(() => new PlayViewReply()).ParseFrom(ReadMessage(data));
Expand Down
2 changes: 1 addition & 1 deletion BBDown.Core/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static async Task<string> GetPlayJsonAsync(string encoding, string aidOr

private static async Task<string> GetPlayJsonAsync(string aid, string cid, string epId, string qn, string code = "0")
{
bool isBiliPlus = Config.HOST == "api.bilibili.com";
bool isBiliPlus = Config.HOST != "api.bilibili.com";
string api = $"https://{(isBiliPlus ? Config.HOST : "api.biliintl.com")}/intl/gateway/v2/ogv/playurl?";

StringBuilder paramBuilder = new();
Expand Down