xadssa commited on
Commit
4260bb9
·
1 Parent(s): 35bd2de

Update index.php

Browse files
Files changed (1) hide show
  1. index.php +18 -43
index.php CHANGED
@@ -1,44 +1,19 @@
1
  <?php
2
- /*
3
- .php?id=0&hq 無線新聞台1080P
4
- .php?id=0 無線新聞台720P
5
- .php?id=1 無線新聞台360P
6
- .php?id=2&hq 無線財經·體育·資訊台1080P
7
- .php?id=2 無線財經·體育·資訊台720P
8
- .php?id=3 無線財經·體育·資訊台360P
9
- .php?id=4&hq 事件直播頻道1 1080P(全清晰度)
10
- .php?id=4 事件直播頻道1 720P
11
- .php?id=5 事件直播頻道1 576P
12
- .php?id=6&hq 事件直播頻道2 1080P(全清晰度)
13
- .php?id=6 事件直播頻道2 720P
14
- .php?id=7 事件直播頻道2 576P
15
- */
16
- $id = $_GET['id'];
17
- $ids = ['I-NEWS','I-NEWS','I-FINA','I-FINA','NEVT1','NEVT1','NEVT2','NEVT2'];
18
- $hq = $_GET['hq'];
19
- if(!isset($ids[$id])) {
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;