正文

乐视云解析源码

乐视云解析源码

  1. <?php  
  2. /** 
  3.  
  4. 乐视云 
  5. * 
  6. */  
  7.   
  8. echo json_encode(LeCloud::parse($url));  
  9. /** 
  10.  
  11. */  
  12. class LeCloud  
  13. {  
  14.     public static function parse($url)  
  15.     {  
  16.       $_loc1_ = $url;  
  17.       $_loc3_ = explode('|’,$_loc1_);  
  18.       $uu = explode(“:",$_loc3_[0])[1];  
  19.       $vu = explode(“:",$_loc3_[1])[1];  
  20.       return self::get_video($uu,$vu);  
  21.     }  
  22.     public static function get_video($uuid,$vuid){  
  23.         $sign = md5(“cfflashformatjsonran".time().“uu{$uuid}ver2.2vu{$vuid}2f9d6924b33a165a6d8b5d3d42f4f987");  
  24.         $v = json_decode(self::https_curl(“api.letvcloud.com/gpc.php?cf=flash&format=json&ran=".time().“&uu={$uuid}&ver=2.2&vu={$vuid}&sign={$sign}"),true);  
  25.         $ltyp = array(“low"=>“标清",“high"=>“高清",“super"=>“超清",“yuanhua"=>“原画");  
  26.         foreach$v['data’]['video_info’]['media’] as $l=>$row ){  
  27.             $f['mp4’][$ltyp[$l]] = base64_decode($row['play_url’]['main_url’]);  
  28.             $f['m3u8’][$ltyp[$l]] = str_replace(“tss=no",“tss=ios",base64_decode($row['play_url’]['main_url’]));  
  29.         }  
  30.         $data = array(  
  31.             'title’ => $v['data’]['video_info’]['video_name’],  
  32.             'poster’ => $v['data’]['play_info’]['init_pic’],  
  33.             'data’ => $f,  
  34.         );  
  35.         $data['url’] = isset($data['data’]['mp4’]['原画’]) ? $data['data’]['mp4’]['原画’] : isset($data['data’]['mp4’]['超清’]) ? $data['data’]['mp4’]['超清’] : $data['data’]['mp4’]['高清’];  
  36.         if$v['code’]==0 ){  
  37.             $printr = array('code’ => 200, 'msg’ => 'success’, 'play’ => 'h5mp4′,’data’ => $data);  
  38.         }else{  
  39.             $printr = array('code’ => 404, 'msg’ => 'ㄟ( ▔, ▔ )ㄏ,参数错误’);  
  40.         }  
  41.         return $printr;  
  42.     }  
  43.     public static function https_curl($url){  
  44.         $curl = curl_init();  
  45.         curl_setopt($curl, CURLOPT_URL, $url);  
  46.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);  
  47.         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);  
  48.         return curl_exec($curl);  
  49.     }  
  50. }