Update index.php
Browse files
index.php
CHANGED
@@ -1,44 +1,19 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
.
|
14 |
-
.
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
exit();
|
21 |
-
};
|
22 |
-
$header[] = 'CLIENT-IP:127.0.0.1';
|
23 |
-
$header[] = 'X-FORWARDED-FOR:127.0.0.1';
|
24 |
-
$ch = curl_init();
|
25 |
-
curl_setopt($ch,CURLOPT_URL,'https://inews-api.tvb.com/news/checkout/live/hd/ott_'.$ids[$id].'_h264?profile=safari');
|
26 |
-
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
|
27 |
-
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
|
28 |
-
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
|
29 |
-
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
|
30 |
-
$data = curl_exec($ch);
|
31 |
-
curl_close($ch);
|
32 |
-
$json = json_decode($data);
|
33 |
-
$url = $json->content->url;
|
34 |
-
if(isset($hq)) {
|
35 |
-
if($id == '4' || $id == '5' || $id == '6' || $id == '7') {
|
36 |
-
header('location:'.preg_replace('/&p=(.*?)$/','',$url->hd));
|
37 |
-
} else {
|
38 |
-
header('location:'.preg_replace('/&p=(.*?)$/','&p=3000',$url->hd));
|
39 |
-
};
|
40 |
-
} else if($id == '0' || $id == '2' || $id == '4' || $id == '6') {
|
41 |
-
header('location:'.$url->hd);
|
42 |
-
} else {
|
43 |
-
header('location:'.$url->sd);
|
44 |
-
};
|
|
|
1 |
<?php
|
2 |
+
date_default_timezone_set("Asia/Shanghai");
|
3 |
+
$channel = empty($_GET['id']) ? "cctv16hd4k/15000000" : trim($_GET['id']);
|
4 |
+
$stream = "http://223.111.117.11/liveplay-kk.rtxapp.com/live/program/live/{$channel}/";
|
5 |
+
$timestamp = substr(time(), 0, 9) - 7;
|
6 |
+
$current = "#EXTM3U" . PHP_EOL;
|
7 |
+
$current .= "#EXT-X-VERSION:3" . PHP_EOL;
|
8 |
+
$current .= "#EXT-X-TARGETDURATION:3" . PHP_EOL;
|
9 |
+
$current .= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}" . PHP_EOL;
|
10 |
+
for ($i = 0; $i < 3; $i++) {
|
11 |
+
$timematch = $timestamp . '0';
|
12 |
+
$timefirst = date('YmdH', $timematch);
|
13 |
+
$current .= "#EXTINF:3," . PHP_EOL;
|
14 |
+
$current .= $stream . $timefirst . "/" . $timestamp . ".ts" . PHP_EOL;
|
15 |
+
$timestamp = $timestamp + 1;
|
16 |
+
}
|
17 |
+
header("Content-Type: application/vnd.apple.mpegurl");
|
18 |
+
header("Content-Disposition: attachment; filename=index.m3u8");
|
19 |
+
echo $current;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|