歪歪神曲解析源码(参考)
2018-12-4
阅读:1589
只提供参考,自行测试更多资源交流群516722628
//$url = "http://www.yy.com/x/15012_1222559164_38974734_1527084874496";
//$url = "http://www.yy.com/sv/9221285915528344768";
//$url = "http://www.yy.com/shenqu/play/id_1134094401301923854.html";
// $api = http://api-tinyvideo-web.yy.com/tinyVideo/getDetailsForVideo?appId=svwebpc&sign=&data=%7B%22resid%22%3A%229180350519213102625%22%2C%22uid%22%3A1%7D&_=1527172814634
echo json_encode(YY::parse($url));
/**
*
*/
class YY
{
public static function parse($url)
{
$content = self::curl($url);
if(strstr($url,"/shenqu/play/")==true){
preg_match('#snapshot":"(.*)","conv#',$content,$img);
preg_match('#worksUrl":"(.*)","likeCou#',$content,$vurl);
preg_match('#worksName":"(.*).","singerPho#',$content,$name);
// print_r('1:'.$name);exit;
$pic = "http:".$img[1];
$type = 'h5mp4';
}else if(strstr($url,"/sv/")==true){
preg_match('#window.resid = \'(.*)\';#',$content,$id);
preg_match('#window.owneruid = \'(.*)\';#',$content,$uid);
$url = "http://api-tinyvideo-web.yy.com/tinyVideo/getDetailsForVideo?appId=svwebpc&sign=&data=%7B%22resid%22%3A%22".$id['1']."%22%2C%22uid%22%3A1%7D&_=".GlobalBase::getMillisecond();
$data = self::curl($url,'http://www.yy.com/sv/'.$id['1']);
$data = json_decode($data,true);
$data = $data['data']['data'];
$vurl['1'] = $data['resurl'];
$pic = $data['snapshoturl'];
$type = 'h5mp4';
//print_r($data);exit;
}else if(strstr($url,"/x/")==true){
preg_match('#video:\s{0,}"(.*)",#',$content,$vurl);
preg_match('#title:\s{0,}"(.*)",#',$content,$name);
preg_match('#pic:\s{0,}"(.*)",#',$content,$img);
//print_r('3:'.$name);exit;
$pic = $img[1];
$type = 'hls';
}
$mp4 = str_replace('\u002F','/',$vurl[1]);
$videoinfo['code'] = 200;
$videoinfo["poster"]= $pic;
$videoinfo['play'] = $type;
$videoinfo["data"]["url"] = $mp4;
return $videoinfo;
}
public static function curl($url,$ref='')
{
$params["ua"] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36";
if ($ref) {
$params['ref'] = $ref;
}
return GlobalBase::curl($url,$params);
}
}
?>
生成海报
版权声明
本文基于《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
文章链接:https://www.pohaier.com/2018/12/04/141.html (转载时请注明本文出处及文章链接)
支付宝打赏
微信打赏
如果觉得我的文章对你有用,请随意赞赏
打赏一下,感谢您的支持!
×
取消
打赏一下,感谢您的支持!
×
取消