diff --git a/BBDown.Core/Parser.cs b/BBDown.Core/Parser.cs index 214c75619..be0194730 100644 --- a/BBDown.Core/Parser.cs +++ b/BBDown.Core/Parser.cs @@ -29,21 +29,20 @@ private static async Task GetPlayJsonAsync(string encoding, string aidOr if (appApi) return await AppHelper.DoReqAsync(aid, cid, epId, qn, bangumi, encoding, Config.TOKEN); - string prefix = tvApi ? bangumi ? "api.snm0516.aisee.tv/pgc/player/api/playurltv" : "api.snm0516.aisee.tv/x/tv/ugc/playurl" + string prefix = tvApi ? bangumi ? "api.snm0516.aisee.tv/pgc/player/api/playurltv" : "api.snm0516.aisee.tv/x/tv/playurl" : bangumi ? $"{Config.HOST}/pgc/player/web/playurl" : "api.bilibili.com/x/player/wbi/playurl"; prefix = $"https://{prefix}?"; string api; - if (tvApi && bangumi) + if (tvApi) { - api = (Config.TOKEN != "" ? $"access_key={Config.TOKEN}&" : "") + - $"aid={aid}&appkey=4409e2ce8ffd12b8&build=102801" + - $"&cid={cid}&device=android&ep_id={epId}&expire=0" + - $"&fnval=4048&fnver=0&fourk=1" + - $"&mid=0&mobi_app=android_tv_yst" + - $"&module=bangumi&npcybs=0&otype=json&platform=android" + - $"&qn={qn}&ts={GetTimeStamp(true)}"; - api = prefix + api + $"&sign={GetSign(api, false)}"; + StringBuilder apiBuilder = new(); + if (Config.TOKEN != "") apiBuilder.Append($"access_key={Config.TOKEN}&"); + apiBuilder.Append($"appkey=4409e2ce8ffd12b8&build=106500&cid={cid}&device=android"); + if (bangumi) apiBuilder.Append($"&ep_id={epId}&expire=0"); + apiBuilder.Append($"&fnval=4048&fnver=0&fourk=1&mid=0&mobi_app=android_tv_yst"); + apiBuilder.Append($"&object_id={aid}&platform=android&playurl_type=1&qn={qn}&ts={GetTimeStamp(true)}"); + api = $"{prefix}{apiBuilder}&sign={GetSign(apiBuilder.ToString(), false)}"; } else { @@ -51,19 +50,11 @@ private static async Task GetPlayJsonAsync(string encoding, string aidOr StringBuilder apiBuilder = new(); apiBuilder.Append($"avid={aid}&cid={cid}&fnval=4048&fnver=0&fourk=1"); if (Config.AREA != "") apiBuilder.Append($"&access_key={Config.TOKEN}&area={Config.AREA}"); - if (tvApi) - { - apiBuilder.Append("&device=android&platform=android&mobi_app=android_tv_yst&npcybs=0&force_host=2&build=102801"); - if(Config.TOKEN != "") apiBuilder.Append($"&access_key={Config.TOKEN}"); - } apiBuilder.Append($"&otype=json&qn={qn}"); if (bangumi) apiBuilder.Append($"&module=bangumi&ep_id={epId}&session="); - else if (!tvApi) - { - if (Config.COOKIE == "") apiBuilder.Append("&try_look=1"); - apiBuilder.Append($"&wts={GetTimeStamp(true)}"); - } - api = prefix + ((bangumi || tvApi) ? apiBuilder.ToString() : WbiSign(apiBuilder.ToString())); + if (Config.COOKIE == "") apiBuilder.Append("&try_look=1"); + apiBuilder.Append($"&wts={GetTimeStamp(true)}"); + api = prefix + (bangumi ? apiBuilder.ToString() : WbiSign(apiBuilder.ToString())); } //课程接口