From 0f71dbf4543dd3cd713e0770036c01c995f2eb80 Mon Sep 17 00:00:00 2001 From: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:55:07 +0800 Subject: [PATCH] fix tv parser --- BBDown.Core/Parser.cs | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/BBDown.Core/Parser.cs b/BBDown.Core/Parser.cs index e48ce7c25..be0194730 100644 --- a/BBDown.Core/Parser.cs +++ b/BBDown.Core/Parser.cs @@ -34,16 +34,15 @@ private static async Task GetPlayJsonAsync(string encoding, string aidOr 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())); } //课程接口