Skip to content

Commit

Permalink
修复虎牙播放问题 #50
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyaocz committed Mar 18, 2024
1 parent 367ad4d commit 1953e1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions AllLive.Core/Huya.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ public string ProcessAnticode(string anticode, string uid, string streamname)
{
// https://github.com/iceking2nd/real-url/blob/master/huya.py
var query = HttpUtility.ParseQueryString(anticode);
query["t"] = "100";
query["ctype"] = "huya_live";
query["t"] = "102";
query["ctype"] = "tars_mp";
var wsTime = (Utils.GetTimestamp() + 21600).ToString("x");
var seqId =(Utils.GetTimestampMs() + long.Parse(uid)).ToString();
var fm = Encoding.UTF8.GetString(Convert.FromBase64String(Uri.UnescapeDataString(query["fm"])));
Expand All @@ -369,7 +369,7 @@ public string ProcessAnticode(string anticode, string uid, string streamname)
map.Add("uid", uid);
map.Add("uuid", GetUuid().ToString());
map.Add("t", query["t"]);
map.Add("sv", "2110211124");
map.Add("sv", "2401310322");

//将map转为字符串
var param = string.Join("&", map.AllKeys.Select(x => $"{x}={map[x]}"));
Expand Down
2 changes: 1 addition & 1 deletion AllLive.UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity
Name="5421.24244EC421563"
Publisher="CN=43A199A3-3813-4434-830F-536BE5EFB42E"
Version="1.2.6.0" />
Version="1.2.7.0" />

<mp:PhoneIdentity PhoneProductId="a29ec443-66b9-4d8d-8fd1-ffa29cf08e96" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
4 changes: 4 additions & 0 deletions AllLive.UWP/Views/LiveRoomPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ private void SetPlayer(string url)
{
media.AddOption("http-referrer=https://live.bilibili.com");
media.AddOption("http-user-agent=Mozilla/5.0 BiliDroid/1.12.0 (bbcallen@gmail.com)");
}else if (liveRoomVM.SiteName == "虎牙直播")
{
media.AddOption("http-referrer=https://www.huya.com");
media.AddOption("http-user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0");
}
media.StateChanged += Media_StateChanged;
mediaPlayer.Play(media);
Expand Down

0 comments on commit 1953e1c

Please sign in to comment.