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

fix tv parser #907

Merged
merged 2 commits into from
Jul 24, 2024
Merged
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
33 changes: 12 additions & 21 deletions BBDown.Core/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,32 @@ private static async Task<string> 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
{
// 尝试提高可读性
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