• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

解析获取优酷视频真实下载地址的PHP源代码_php技巧

php 搞代码 3年前 (2022-01-26) 28次浏览 已收录 0个评论
<?php <BR>//--调用方法/demo.php?url=http://v.youku.com/v_show/id_XMzkyODA2NTEy.html <BR>echo getYoukuFlv($_GET['url']); <br><br>function getYoukuFlv($url){ <BR>    preg_match("#id_(.*?)\.html#",$url,$out); <BR>    $id=$out[1]; <BR>    $content=get_curl_contents('http://v.youku.com/player/getPlayList/VideoIDS/'.$id); <BR>    $data=json_decode($content); <BR>    foreach($data->data[0]->streamfileids AS $k=>$v){ <BR>    $sid=getSid(); <BR>    $fileid=getfileid($v,<em style="color:transparent">本文来源[email protected]搞@^&代*@码)网9</em><strong>搞代gaodaima码</strong>$data->data[0]->seed); <BR>    $one=($data->data[0]->segs->$k); <BR>    if($k == 'flv' || $k == 'mp4') return "http://f.youku.com/player/getFlvPath/sid/{$sid}_00/st/{$k}/fileid/{$fileid}?K={$one[0]->k}"; <BR>    continue; <BR>    } <BR>}  <BR>function get_curl_contents($url, $second = 5){ <BR>    if(!function_exists('curl_init')) die('php.ini未开启php_curl.dll'); <BR>    $c = curl_init(); <BR>    curl_setopt($c,CURLOPT_URL,$url); <BR>    $UserAgent=$_SERVER['HTTP_USER_AGENT']; <BR>    curl_setopt($c,CURLOPT_USERAGENT,$UserAgent); <BR>    curl_setopt($c,CURLOPT_HEADER,0); <BR>    curl_setopt($c,CURLOPT_TIMEOUT,$second); <BR>    curl_setopt($c,CURLOPT_RETURNTRANSFER, true); <BR>    $cnt = curl_exec($c); <BR>    $cnt=mb_check_encoding($cnt,'utf-8')?iconv('gbk','utf-8//IGNORE',$cnt):$cnt; //字符编码转换 <BR>    curl_close($c); <BR>    return $cnt; <BR>} <BR>function getSid() { <BR>    $sid = time().(rand(0,9000)+10000); <BR>    return $sid; <BR>} <BR>function getkey($key1,$key2){ <BR>    $a = hexdec($key1); <BR>    $b = $a ^ 0xA55AA5A5; <BR>    $b = dechex($b); <BR>    return $key2.$b; <BR>} <BR>function getfileid($fileId,$seed) { <BR>    $mixed = getMixString($seed); <BR>    $ids = explode("*",$fileId); <BR>    unset($ids[count($ids)-1]); <BR>    $realId = ""; <BR>    for ($i=0;$i < count($ids);++$i) { <BR>    $idx = $ids[$i]; <BR>    $realId .= substr($mixed,$idx,1); <BR>    } <BR>    return $realId; <BR>} <BR>function getMixString($seed) { <BR>    $mixed = ""; <BR>    $source = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890"; <BR>    $len = strlen($source); <BR>    for($i=0;$i< $len;++$i){ <BR>    $seed = ($seed * 211 + 30031) % 65536; <BR>    $index = ($seed / 65536 * strlen($source)); <BR>    $c = substr($source,$index,1); <BR>    $mixed .= $c; <BR>    $source = str_replace($c, "",$source); <BR>    } <BR>    return $mixed; <BR>} <BR>?><BR>

搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:解析获取优酷视频真实下载地址的PHP源代码_php技巧
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址