mirror of
https://github.com/rad168/iptv.git
synced 2026-11-06 06:36:45 +08:00
Implement m3u subscription handling in mytv.php
Added functionality to handle 'm3u' requests and fetch an m3u playlist from a URL.
This commit is contained in:
1 parent
f02ce0a0e4
commit
16f4412901
1 file changed
+29
-1
+29
-1
@@ -3,7 +3,35 @@
|
||||
//ini_set('display_errors', '1');
|
||||
|
||||
$request_url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
|
||||
if (empty($request_url)) {
|
||||
$p = $_GET['p'] ?? '';
|
||||
|
||||
//订阅m3u列表
|
||||
if ($p === 'm3u') {
|
||||
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||
? 'https'
|
||||
: 'http';
|
||||
|
||||
$path = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
||||
|
||||
|
||||
$m3uurl = "https://github.com/rad168/iptv/raw/refs/heads/main/mytv0.m3u";
|
||||
|
||||
$m3u = file_get_contents($m3uurl);
|
||||
|
||||
$m3u = preg_replace(
|
||||
'#http://[^/]+/mytv\.php#',
|
||||
$path,
|
||||
$m3u
|
||||
);
|
||||
|
||||
header("Content-Type: text/plain; charset=utf-8");
|
||||
|
||||
echo $m3u;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($request_url) && empty($p)) {
|
||||
die('缺少 url 参数');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user