找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1184|回复: 22

[iptv信源 资源分享或寻求] PHP提取湖南电信IPTV组播地址及EPG节目单

[复制链接]
本帖最后由 xiangbo80 于 2024-4-18 23:24 编辑

本程序仅适合湖南电信IPTV环境下使用,自动提取组播资源并生成M3U列表格式,自动生成适配的XML格式EPG节目单。
重点:如果你的网络环境无法PING通10.255.0.110,则该贴对你暂无帮助,因不同的路由器或交换机对组播协议支持程度都不同,请自行解决网络环境的问题。


iptv.php:
  1. <?php
  2. header('Content-Type: audio/x-mpegurl');
  3. header('Content-Disposition: attachment; filename="playlist.m3u"');
  4. $url = 'http://10.255.0.110/mgtv_hndx/EPGV2/GetChannelList?OutputType=json&Version=HNDX.0.0_Release_HW_4K&CategoryId=1000&MediaAssetsId=live';
  5. $jsonData = file_get_contents($url);
  6. $data = json_decode($jsonData, true);
  7. if (json_last_error() !== JSON_ERROR_NONE) {
  8.     die('JSON解析错误:' . json_last_error_msg());
  9. }
  10. if ($data["result"]["reason"] !== "OK") {
  11.     die('JSON解析错误:' . json_last_error_msg());
  12. }

  13. echo "#EXTM3U\n";
  14. $iptvlist = $data["l"]["il"];
  15. foreach ($iptvlist as $item) {
  16.     echo '#EXTINF:-1,tvg-id="'.$item["id"].'" tvg-name="'.$item["name"].'" tvg-logo="'.$item["img_h"].'"'."\n";
  17. echo $item["arg_list"]["c_playurl_live_mutlicast"]. "\n";
  18. //echo str_replace("rtp://","http://192.168.123.1:4000/rtp/", $item["arg_list"]["c_playurl_live_mutlicast"]). "\n";
  19. }
  20. ?>
复制代码
参数说明:
CategoryId分组编号可通过以下网址获取:http://10.255.0.110/mgtv_hndx/MA ... &MediaAssetsId=live
程序默认使用RTP或UDP组播源,如果你有搭建UDPROX代理请注释掉第18行,启用第19行并修改相关代理服务器地址,请根据你获取到的组播地址是RTP还是UDP协议并修改相关代码。
注释第2行将不生成M3U文件,可直接调用本程序URL。

epg.php:
  1. <?php
  2. $url = 'http://10.255.0.110/mgtv_hndx/EPGV2/GetChannelList?OutputType=json&Version=YYS.4.5.19.266.2.HNDX.0.0_Release_HW_4K&CategoryId=1000&MediaAssetsId=live';
  3. $jsonData = file_get_contents($url);
  4. $data = json_decode($jsonData, true);

  5. $xml = new SimpleXMLElement('<?xml version="1.0"?><tv></tv>');
  6. $xml->addAttribute("generator-info-name", "湖南电信IPTV-EPG");
  7. $iptvlist = $data["l"]["il"];
  8. foreach ($iptvlist as $item) {
  9.         $channl=$xml->addChild("channel");
  10.         $channl->addAttribute("id", $item["name"]);
  11.         $channl->addChild("display-name", $item["name"]);
  12.         $url2 = "http://10.255.0.110/mgtv_hndx/BasicIndex/GetPlaybill?AfterDay=3&TimeZone=8&OutputType=json&Version=YYS.4.5.19.266.2.HNDX.0.0_Release_HW_4K&VideoType=1&Mode=relative&VideoId=".$item["id"]."&BeforeDay=0";
  13.         $menudata = file_get_contents($url2);
  14.         $menulist = json_decode($menudata, true);
  15.         foreach ($menulist["day"] as $item1) {
  16.                 foreach ($item1["item"] as $v) {
  17.                         $v["start"]=$item1["day"].$v["begin"];
  18.                         $v["stop"]=$v["start"]+$v["time_len"];
  19.                         $programme=$xml->addChild("programme");
  20.                         $programme->addAttribute("start", $v["start"]." +0800");
  21.                         $programme->addAttribute("stop", $v["stop"]." +0800");
  22.                         $programme->addAttribute("channel", $item["name"]);
  23.                         $programme->addChild("title", $v["text"]);
  24.                 }
  25.         }
  26. }
  27. header("Content-type: application/xml");
  28. echo $xml->asXML();
  29. ?>
复制代码
参数说明:
AfterDay表示查看几天后的节目单。

BeforeDay表示查看几天前的节目单,默认为0,这个只有看回放才有用。

CategoryId使用默认的1000就行,已经适配了所有分组节目。


点评

湖南电信的IPTV源,还有很多地方台。比如道县、津市、衡阳县、桂东、溆浦、茶陵、新化、宁乡、鼎城等,大佬,有空高高呗。  发表于 2024-4-22 12:08
靓仔,感谢有你分享,真好  发表于 2024-4-19 05:52

评分

参与人数 2恩山币 +2 收起 理由
0po*** + 1 湖南道县IPTV还有些地方台怎么没有?比如道.
0x*** + 1 感谢大佬分享..

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
大佬能不能修改下 让它在当前目录下生成xml文件啊

点评

第5、6行改成如下即生成XML并下载: header('Content-Disposition: attachment; filename="epg.xml"'); $xml = new SimpleXMLElement('');  详情 回复 发表于 2024-4-19 00:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

真棒,感谢分享!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
0x90 发表于 2024-4-18 23:47
大佬能不能修改下 让它在当前目录下生成xml文件啊

第5、6行改成如下即生成XML并下载:
header('Content-Disposition: attachment; filename="epg.xml"');
$xml = new SimpleXMLElement('<?xml version="1.0"  encoding="utf-8"?><tv></tv>');

点评

感谢,,弄好了....  详情 回复 发表于 2024-4-19 01:18
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

xiangbo80 发表于 2024-4-19 00:01
第5、6行改成如下即生成XML并下载:
header('Content-Disposition: attachment; filename="epg.xml"');
$ ...

感谢,,弄好了....
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

学习大佬牛逼
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
大佬牛B,晚上回家试试
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

希望搞个陕西电信能用的就好了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

感谢大佬分享。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

技术贴 必须支持,希望有大佬能写一个适用上海电信的节目单和EPG的PHP代码,先谢谢啦
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

湖南移动有嘛~移动
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

技术贴 必须支持,希望有大佬能写一个适用广东电信的节目单和EPG的PHP代码,先谢谢啦
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

这个很强大,空的时候试一试。谢谢楼主的分享!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
好东西啊,谢谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
必须支持,希望有大佬能写一个适用成都电信的节目单和EPG的PHP代码,先谢谢啦
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-5-2 09:56

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表