James 发表于 2023-6-10 17:09:11

量子非凡资源站去广告的代码,把里面的域名换成自己的域名就可以了!

loc发不了发这里了。


<?php
error_reporting(0);
//关闭所有PHP错误报告
define('IFHC',1);
//是否缓存视频链接 1 缓存 0 不缓存
define('HCFILE',__DIR__.'/cache/');
//缓存保存的文件夹 如果不缓存请无视
define('HCTIME',604800);
//缓存时效 秒为单位 如果不缓存请无视
header('Content-type: text/json;charset=utf-8');

$url = $_GET['url'];
$MD5 = Md5($url).'.m3u8';
if (is_dir(HCFILE)==false) {
mkdir(HCFILE,0755,true);
}
if (IFHC==1 && file_exists(HCFILE.$MD5) && filemtime(HCFILE.$MD5) + HCTIME > time()) {
$arr = array(
    'code' => 200,
    'msg' => '解析成功',
    'cache' => true,
    'url' => 'https://www.wucuoym.com/cache/'.$MD5
);
die(json_encode($arr,456));
}
$data = curl($url);
if (empty($data)) {
die(404);
}
if (strstr($data,'.ts')==false) {
$explode = explode('/',$data);
$ts = explode("\n",$explode);
$url = str_replace('index.m3u8','', $url).$ts.'/'.$explode.'/'.$explode;
$data = curl($url);
if (empty($data)) {
die(404);
}
}
echo m3u8ts($url,$MD5,$data,$explode);


function m3u8ts($wz , $file , $data , $name){
    $data = preg_replace('/#EXTINF:(.*),\n?http(.*)\n?/','',$data);
    preg_match('/\/\/(.*)\/'.$name.'/',$wz,$ym);
    $web = 'https:'.str_replace($name,'', $ym);
    $m3u8 = preg_replace('/#EXTINF:(.*),\n?(.*)\n?/',"#EXTINF:$1,\n$web$2\n",$data);
    file_put_contents(HCFILE.$file,$m3u8);
    $arr = array(
      'code' => 200,
      'msg' => '解析成功',
      'url' => 'https://www.wucuoym.com/cache/'.$file
    );
    die(json_encode($arr,456));
    return;
}
function curl($url) {
if(!function_exists('curl_init')) die('php.ini未开启php_curl.dll');
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "accept: */*",
    "accept-encoding: gzip, deflate",
    "accept-language: zh-CN,zh;q=0.9",
    "Connection: keep-alive",
));
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36');
curl_setopt($ch, CURLOPT_REFERER,'https://www.wucuoym.com/');
curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
@ $file = curl_exec($ch);
curl_close($ch);
return $file;
}

人穷脸丑农村户口 发表于 2023-6-10 17:10:14

这个是干什么的

y03831 发表于 2023-6-11 02:15:56

这个是干什么的

amiccf 发表于 2023-6-11 02:43:43

这个年着不错

Timor 发表于 2023-6-11 09:11:32

这个文件放网站根目录吗还是放哪里

KiteMoon 发表于 2023-6-11 13:51:51

这个是,。,干啥的啊?

xiaow 发表于 2023-6-11 16:25:23

啥资源???

emily1218 发表于 2023-6-11 18:18:18

这个是,。,干啥的啊?

pannifeng 发表于 2023-6-11 18:43:42

鉴别过了,大水皮
页: [1]
查看完整版本: 量子非凡资源站去广告的代码,把里面的域名换成自己的域名就可以了!