From fe7daf9d3c2f2196a7b5ccb550a7e07a1b9a783d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=A5=E7=BE=8A?= Date: Fri, 31 May 2024 04:15:42 +0800 Subject: [PATCH] fix huya.php --- PHP/huya.php | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/PHP/huya.php b/PHP/huya.php index 319f1f2..8217ec6 100644 --- a/PHP/huya.php +++ b/PHP/huya.php @@ -1,10 +1,11 @@ [], 'hls' => []]; - $cdn_type = ['HY' => 'hycdn', 'AL' => 'alicdn', 'TX' => 'txcdn', 'HW' => 'hwcdn', 'HS' => 'hscdn', 'WS' => 'wscdn']; - foreach ($livearr["roomInfo"]["tLiveInfo"]["tLiveStreamInfo"]["vStreamInfo"]["value"] as $s) { + $cdn_type = ['HY' => 'hycdn', 'TX' => 'txcdn', 'HW' => 'hwcdn', 'HS' => 'hscdn', 'WS' => 'wscdn']; + foreach ($realdata["stream"]["baseSteamInfoList"] as $s) { if ($s["sFlvUrl"]) { $stream_info["flv"][$cdn_type[$s["sCdnType"]]] = $s["sFlvUrl"] . '/' . $s["sStreamName"] . '.' . $s["sFlvUrlSuffix"] . '?' . process_anticode($s["sFlvAntiCode"], $uid, $s["sStreamName"]); } @@ -99,15 +103,7 @@ function format($livearr, $uid) return $stream_info; } -$res = get_content($roomurl, "mobile"); -$reg = "/\ window.HNF_GLOBAL_INIT = (.*) \<\/script\>/i"; -preg_match($reg, $res, $realres); -$realdata = json_decode($realres[1], true); - -if (array_key_exists("exceptionType", $realdata)) { - header('location:' . $mediaurl); - exit(); -} elseif ($realdata["roomInfo"]["eLiveStatus"] == 2) { +if ($jsonStr["status"] == 200) { $realurl = format($realdata, $uid); if ($type == "display") { print_r($realurl); @@ -135,10 +131,7 @@ if (array_key_exists("exceptionType", $realdata)) { } header('location:' . $mediaurl); exit(); -} elseif ($realdata["roomInfo"]["eLiveStatus"] == 3) { - header('location:' . "https:" . base64_decode($realdata["roomProfile"]["liveLineUrl"])); - exit(); } else { header('location:' . $mediaurl); exit(); -} +} \ No newline at end of file