小辉网络社区致力于优质软件,活动线报,游戏辅助,绿色工具等资源共享,好货不私藏!

西瓜视频地址解析php代码

小辉工作室 其他源码

西瓜视频这个平台里太多自媒体翻唱以及制作的精彩视频,小编非常喜欢听音乐,经常去西瓜视频上面去找好歌听,看到喜欢的西瓜歌曲视频就想要保存到本地收藏,于是小编分享西瓜视频地址解析php代码就产生了,这个php解析西瓜视频地址代码比较粗糙,但不影响使用可以正常解析出西瓜视频地址,把代码复制到新建的php文件里,浏览器通过网址访问php文件并传递西瓜视频播放地址过去就可以解析视频地址,使用时注意要把防盗链域名改成你自己的。

<?php
error_reporting(0);
header('Content-Type:text/html; charset=utf-8');
date_default_timezone_set('Asia/Shanghai');
function Zhuan($str){
$encode = mb_detect_encoding($str, array('CP936', "ASCII","GB2312","GBK",'UTF-8','BIG5'));
if ($encode == 'UTF-8'){
return $str;
} elseif ($encode == 'CP936') {
return iconv('utf-8', 'latin1//IGNORE', $str);
} else {
return mb_convert_encoding($str, 'UTF-8', $encode);
}
}
$domain = trim($_SERVER['SERVER_NAME']);
$opendomain = array("127.0.0.1","localhost","lanyes.org");
$diymusic = 'http://tts.baidu.com/text2audio?idx=1&tex=%E8%AF%B7%E5%8B%BF%E7%9B%97%E9%93%BE%E6%9D%A5%E8%87%AA%E4%B8%8E%E8%93%9D%E5%8F%B6%E5%88%86%E4%BA%AB%E7%9A%84%E9%9F%B3%E4%B9%90%E9%93%BE%E6%8E%A5%EF%BC%8C%E8%AF%B7%E8%87%AA%E8%A1%8C%E8%A7%A3%E5%86%B3%E9%9F%B3%E4%B9%90%E5%A4%96%E9%93%BE%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82&cuid=baidu_speech_demo&cod=2&lan=zh&ctp=1&pdt=1&spd=4&vol=5&pit=5&per=4';
if(in_array($domain, $opendomain)){
$url = isset($_GET['url']) ? addslashes($_GET['url']) : 'https://www.ixigua.com/6852864760908612103/';
$curl = curl_init();
$header=array(
"accept-language: zh-CN,zh;q=0.9",
"X-FORWARDED-FOR:180.149.134.142",
"CLIENT-IP:180.149.134.142",
);
curl_setopt($curl, CURLOPT_URL, $url.'?wid_try=1');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_HTTPHEADER,$header);
curl_setopt($curl, CURLOPT_REFERER, $url.'?wid_try=1');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$response = curl_exec($curl);
curl_close($curl);
preg_match_all('/"video_list":{(.*)}},"extraInfos"/i',$response,$matchs);
if(empty($matchs[1][0])){
preg_match_all('/"video_list":{(.*)}},"barrage_mask_url"/i',$response,$matchs);
}
preg_match('/"vheight":1080,(.*)"main_url":"(.*)","backup_url_1"/i',$matchs[1][0],$bdmatch);
preg_match('/"vheight":720,(.*)"main_url":"(.*)","backup_url_1"/i',$matchs[1][0],$hdmatch);
preg_match('/"vheight":480,(.*)"main_url":"(.*)","backup_url_1"/i',$matchs[1][0],$cdmatch);
preg_match('/"vheight":360,(.*)"main_url":"(.*)","backup_url_1"/i',$matchs[1][0],$admatch);
$bdurl = str_replace('.Ma','?a',Zhuan(base64_decode(trim($bdmatch[2]))));
$hdurl = str_replace('.Ma','?a',Zhuan(base64_decode(trim($hdmatch[2]))));
$cdurl = str_replace('.Ma','?a',Zhuan(base64_decode(trim($cdmatch[2]))));
$adurl = str_replace('.Ma','?a',Zhuan(base64_decode(trim($admatch[2]))));
if($bdurl){
$videourl = $bdurl;
}elseif($hdurl){
$videourl = $hdurl;
}elseif($cdurl){
$videourl = $cdurl;
}else{
$videourl = $adurl;
}
$videourl = str_replace('http:','https:',$videourl);//www.lxh5068.com
header("location: $videourl");exit;
}else{header('Location:'.$diymusic);exit();}
?>

温馨提示:如有转载或引用以上内容请将本文链接作为出处标注!百度已收录

免责声明:本站提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序,请支持正版,购买注册,得到更好的正版服务。侵删请致信E-mail:431228450@qq.com

标签 暂无标签
资源分享
评论列表