Skip to content

Instantly share code, notes, and snippets.

@zhusaidong
Created December 14, 2018 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhusaidong/dde692e2cd937d417b09809b5ea001d5 to your computer and use it in GitHub Desktop.
Save zhusaidong/dde692e2cd937d417b09809b5ea001d5 to your computer and use it in GitHub Desktop.
解析 app.baiyug.cn
<?php
/**
* 解析 app.baiyug.cn
* @author zhusaidong [zhusaidong@gmail.com]
*/
/**
* curl post
*/
function curlPost($url,$postData = [])
{
$header = array(
'Referer'=>'http://222.187.224.181:4466/vip_g/index.php?url=',
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData));
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
/**
* get key
*/
function getKey($url)
{
$data = curlPost('http://222.187.224.181:4466/vip_g/index.php?url='.$url);
preg_match('/eval\("(.*)"\);player/i',$data,$match);
$key = isset($match[1]) ? $match[1] : '';
$key = urldecode(str_replace('\x','%',$key));
return substr($key,16,-3);
}
/**
* get video url
*/
function getUrl($url)
{
$data = curlPost('http://222.187.224.181:4466/api_g/api.php',[
'time' =>time(),
//看key会不会失效,如果会失效,就要用`getKey()`
'key' =>'1e72c91e31c180d0ccf3429687b73add',//getKey($url),
'key2' =>'',
'url' =>$url,
]);
$data = json_decode($data,TRUE);
if($data['success'] == 1)
{
return $data['url'];
}
return NULL;
}
var_dump(getUrl('http://v.qq.com/x/cover/bojb6fxtqh2ekw0.html'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment