This repository has been archived on 2022-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
apiOld/live/ghink/api.php
2021-02-07 22:08:48 +08:00

42 lines
1.0 KiB
PHP

<?php
header("Content-type:application/json;charset=utf-8");
function decodeUnicode($str){
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return iconv("UCS-2BE","UTF-8",pack("H*", $matches[1]));'), $str);
}
$json=@decodeUnicode(@file_get_contents("https://api.live.bilibili.com/xlive/web-room/v1/index/getRoomPlayInfo?room_id=21636162&play_url=1&mask=1&qn=0&platform=web"));
$json=json_decode($json);
echo '{"status":';
foreach($json as $ii=>$ii2){
$$ii = $ii2;
}
foreach($data as $ii=>$ii2){
$$ii = $ii2;
}
echo $live_status.',"time":';
echo $live_time;
if($live_status=="1"){
echo ',"url1":"';
foreach($play_url as $ii=>$ii2){
$$ii = $ii2;
}
foreach($durl as $ii=>$ii2){
$$ii = $ii2;
}
foreach($durl[0] as $ii=>$ii2){
$$ii = $ii2;
}
echo $url.'","url2":"';
foreach($durl[1] as $ii=>$ii2){
$$ii = $ii2;
}
echo $url.'","url3":"';
foreach($durl[2] as $ii=>$ii2){
$$ii = $ii2;
}
echo $url.'","url4":"';
foreach($durl[3] as $ii=>$ii2){
$$ii = $ii2;
}
echo $url.'"';
}
echo '}';