Skip to content

Commit

Permalink
Merge pull request nilaoda#776 from My-Responsitories/master
Browse files Browse the repository at this point in the history
修复一些解析问题
  • Loading branch information
nilaoda authored Nov 13, 2023
2 parents 9051270 + 1d29a83 commit fbfeef1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit fbfeef1

Please sign in to comment.