Skip to content

Commit

Permalink
fix tv parser
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Responsitories committed Jul 17, 2024
1 parent d594854 commit 0f71dbf
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions BBDown.Core/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,27 @@ private static async Task<string> 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
{
// 尝试提高可读性
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()));
}

//课程接口
Expand Down

0 comments on commit 0f71dbf

Please sign in to comment.