搜索
 找回密码
 立即注册

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

James 2023-06-10 17:09 1293
loc发不了发这里了。


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

  11. $url = $_GET['url'];
  12. $MD5 = Md5($url).'.m3u8';
  13. if (is_dir(HCFILE)==false) {
  14.   mkdir(HCFILE,0755,true);
  15. }
  16. if (IFHC==1 && file_exists(HCFILE.$MD5) && filemtime(HCFILE.$MD5) + HCTIME > time()) {
  17.   $arr = array(
  18.     'code' => 200,
  19.     'msg' => '解析成功',
  20.     'cache' => true,
  21.     'url' => 'https://www.wucuoym.com/cache/'.$MD5
  22.   );
  23.   die(json_encode($arr,456));
  24. }
  25. $data = curl($url);
  26. if (empty($data)) {
  27.   die(404);
  28. }
  29. if (strstr($data,'.ts')==false) {
  30.   $explode = explode('/',$data);
  31.   $ts = explode("\n",$explode[0])[2];
  32.   $url = str_replace('index.m3u8','', $url).$ts.'/'.$explode[1].'/'.$explode[2];
  33.   $data = curl($url);
  34. if (empty($data)) {
  35.   die(404);
  36. }
  37. }
  38. echo m3u8ts($url,$MD5,$data,$explode[2]);


  39. function m3u8ts($wz , $file , $data , $name){
  40.     $data = preg_replace('/#EXTINF:(.*),\n?http(.*)\n?/','',$data);
  41.     preg_match('/\/\/(.*)\/'.$name.'/',$wz,$ym);
  42.     $web = 'https:'.str_replace($name,'', $ym[0]);
  43.     $m3u8 = preg_replace('/#EXTINF:(.*),\n?(.*)\n?/',"#EXTINF:$1,\n$web$2\n",$data);
  44.     file_put_contents(HCFILE.$file,$m3u8);
  45.     $arr = array(
  46.       'code' => 200,
  47.       'msg' => '解析成功',
  48.       'url' => 'https://www.wucuoym.com/cache/'.$file
  49.     );
  50.     die(json_encode($arr,456));
  51.     return;
  52. }
  53. function curl($url) {
  54. if(!function_exists('curl_init')) die('php.ini未开启php_curl.dll');
  55.   $user_agent = $_SERVER['HTTP_USER_AGENT'];
  56.   $ch = curl_init();
  57.   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  58.     "accept: */*",
  59.     "accept-encoding: gzip, deflate",
  60.     "accept-language: zh-CN,zh;q=0.9",
  61.     "Connection: keep-alive",
  62.   ));
  63.   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');
  64.   curl_setopt($ch, CURLOPT_REFERER,'https://www.wucuoym.com/');
  65.   curl_setopt($ch, CURLOPT_ENCODING, "gzip, deflate");
  66.   curl_setopt($ch, CURLOPT_URL, $url);
  67.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  68.   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  69.   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  70.   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  71.   @ $file = curl_exec($ch);
  72.   curl_close($ch);
  73.   return $file;
  74. }
复制代码


随机推荐

8 回复

这个是干什么的
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
鉴别过了,大水皮
游客
高级模式
返回顶部