歪歪神曲解析源码

资源分享歪歪神曲解析源码

歪歪神曲解析源码

  1. <?php  
  2. //$url = “http://www.yy.com/x/15012_1222559164_38974734_1527084874496";  
  3. //$url = “http://www.yy.com/sv/9221285915528344768";  
  4. //$url = “http://www.yy.com/shenqu/play/id_1134094401301923854.html";  
  5. // $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  
  6. echo json_encode(YY::parse($url));  
  7. /** 
  8.  
  9. */  
  10. class YY  
  11. {  
  12.     public static function parse($url)  
  13.     {  
  14.         $content = self::curl($url);  
  15.   
  16.         if(strstr($url,“/shenqu/play/")==true){  
  17.             preg_match('#snapshot“:"(.*)“,"conv#’,$content,$img);  
  18.             preg_match('#worksUrl“:"(.*)“,"likeCou#’,$content,$vurl);  
  19.             preg_match('#worksName“:"(.*).“,"singerPho#’,$content,$name);  
  20.            // print_r('1:’.$name);exit;  
  21.             $pic = “http:".$img[1];  
  22.             $type = 'h5mp4’;  
  23.         }else if(strstr($url,“/sv/")==true){  
  24.             preg_match('#window.resid = \'(.*)\’;#’,$content,$id);  
  25.             preg_match('#window.owneruid = \'(.*)\’;#’,$content,$uid);  
  26.   
  27.             $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();  
  28.             $data = self::curl($url,’http://www.yy.com/sv/’.$id['1’]);  
  29.             $data = json_decode($data,true);  
  30.             $data = $data['data’]['data’];  
  31.             $vurl['1’] = $data['resurl’];  
  32.             $pic = $data['snapshoturl’];  
  33.             $type = 'h5mp4’;  
  34.             //print_r($data);exit;  
  35.   
  36.         }else if(strstr($url,“/x/")==true){  
  37.             preg_match('#video:\s{0,}“(.*)",#’,$content,$vurl);  
  38.             preg_match('#title:\s{0,}“(.*)",#’,$content,$name);  
  39.             preg_match('#pic:\s{0,}“(.*)",#’,$content,$img);  
  40.             //print_r('3:’.$name);exit;  
  41.             $pic = $img[1];  
  42.             $type = 'hls’;  
  43.         }  
  44.   
  45.         $mp4 =  str_replace('\u002F’,’/’,$vurl[1]);  
  46.         $videoinfo['code’] = 200;  
  47.         $videoinfo[“poster"]= $pic;  
  48.         $videoinfo['play’] = $type;  
  49.         $videoinfo[“data"][“url"] = $mp4;  
  50.         return $videoinfo;  
  51.     }  
  52.     public static function curl($url,$ref=")  
  53.     {  
  54.         $params[“ua"] = “Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36";  
  55.         if ($ref) {  
  56.             $params['ref’] = $ref;  
  57.         }  
  58.         return GlobalBase::curl($url,$params);  
  59.     }  
  60. }  
  61.   
  62. ?>  

Posted by 柴郡猫