<?php header('Content-Type:text/plain'); function yk_e($a, $c){ for ($f=0, $i, $e='', $h=0; 256 > $h; $h++) { $b[$h]=$h; } for ($h=0; 256 > $h; $h++) { $f=(($f + $b[$h]) + charCodeAt($a, $h % strlen($a))) % 256; $i=$b[$h]; $b[$h]=$b[$f]; $b[$f]=$i; } for ($q=($f=($h=0)); $q < strlen($c); $q++) { $h=($h + 1) % 256; $f=($f + $b[$h]) % 256; $i=$b[$h]; $b[$h]=$b[$f]; $b[$f]=$i; $e .= fromCharCode(charCodeAt($c, $q) ^ $b[($b[$h] + $b[$f]) % 256]); } return $e; } function fromCharCode($codes){ if (is_scalar($codes)) { $codes=func_get_args(); } $str=''; foreach ($codes as $code) { $str .= chr($code); } return $str; } function charCodeAt($str, $index){ $charCode=array(); $key=md5($str); $index=$index + 1; if (isset($charCode[$key])) { return $charCode[$key][$index]; } $charCode[$key]=unpack('C*', $str); return $charCode[$key][$index]; } function charAt($str, $index=0){ return substr($str, $index, 1); } $url=!empty($_GET['url'])?$_GET['url']:''; $url.=!empty($_POST['url'])?$_POST['url']:''; if(!empty($url)){ preg_match('#v_show/id_(.*?)\.html#i',$url,$matches); $vid=$matches[1]; $utid='7RFdEcq17HsCAbfRhAjhY4m5'; $link='http://ups.youku.com/ups/get.json?vid='.$vid.'&ccode=0401&client_ip=192.168.1.1&utid='.$utid.'&client_ts='.time();; $curl=curl_init(); curl_setopt($curl,CURLOPT_URL,$link); curl_setopt($curl,CURLOPT_TIMEOUT,10); curl_setopt($curl,CURLOPT_HEADER,0); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); $retval=curl_exec($curl); curl_close($curl); if(!empty($retval)){ $rs=json_decode($retval, true); $stream=$rs['data']['stream']; if (!empty($stream)&&count($stream)>0){ $final_url=$stream[0]['m3u8_url']; $arr = array ('msg'=>'ok','url'=>$final_url,'ext'=>'m3u8','link'=>$link); echo json_encode($arr); } else echo '1'; } else echo '2'; } else echo '3'; ?>
此代码只实现了非VIP用户的m3u8解析,VIP解析将后续跟上