{"id":27227978,"url":"https://github.com/kfcx/Streaming-Media-Server-Pro","last_synced_at":"2025-04-10T12:02:59.917Z","repository":{"id":57791734,"uuid":"527351299","full_name":"kfcx/Streaming-Media-Server-Pro","owner":"kfcx","description":"这是一个强大的IPTV源后端服务，具有视频缓冲区功能，程序内置了很多独家频道，不够？你还可以自定义添加电视源；超多功能接口，还可以添加你的代理，并且适合任意平台，非常适合作为家庭影院的IPTV服务！可玩性超高，更多详情点击查看。","archived":false,"fork":false,"pushed_at":"2023-04-04T11:38:58.000Z","size":591,"stargazers_count":462,"open_issues_count":5,"forks_count":167,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-10T04:25:50.547Z","etag":null,"topics":["collaborate","fastapi","github","github-pages","hls","hls-live-streaming","iptv","live-streaming","m3u8","proxy","python","video-buffer"],"latest_commit_sha":null,"homepage":"https://stream.naihe.cf/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kfcx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://ik.imagekit.io/naihe/pay/hbm.jpg"]}},"created_at":"2022-08-21T23:30:42.000Z","updated_at":"2025-03-09T12:21:56.000Z","dependencies_parsed_at":"2024-11-25T17:33:04.716Z","dependency_job_id":"821ebe2f-e597-4baa-8a52-96aa4f7a7e14","html_url":"https://github.com/kfcx/Streaming-Media-Server-Pro","commit_stats":null,"previous_names":["kfcx/streaming-media-server-pro"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfcx%2FStreaming-Media-Server-Pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfcx%2FStreaming-Media-Server-Pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfcx%2FStreaming-Media-Server-Pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfcx%2FStreaming-Media-Server-Pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfcx","download_url":"https://codeload.github.com/kfcx/Streaming-Media-Server-Pro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248215931,"owners_count":21066626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collaborate","fastapi","github","github-pages","hls","hls-live-streaming","iptv","live-streaming","m3u8","proxy","python","video-buffer"],"created_at":"2025-04-10T12:02:33.066Z","updated_at":"2025-04-10T12:02:59.912Z","avatar_url":"https://github.com/kfcx.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n  \n[Streaming-Media-Server-Pro](https://github.com/239144498/Streaming-Media-Server-Pro)\n-------------\n[![builds](https://github.com/239144498/Streaming-Media-Server-Pro/actions/workflows/docker-image.yml/badge.svg)](https://github.com/239144498/Streaming-Media-Server-Pro/actions/workflows/docker-image.yml)\n[![Netlify Status](https://api.netlify.com/api/v1/badges/31776721-e836-4042-a22a-3afe29ff1824/deploy-status)](https://app.netlify.com/sites/nowtv/deploys)  \n[![Python version](https://img.shields.io/badge/python-\u003e=3.8-green.svg?style=plastic\u0026logo=python)](https://www.python.org/downloads/release/python-380/)\n[![Docker pulls](https://img.shields.io/docker/pulls/239144498/streaming.svg?style=plastic\u0026logo=docker)](https://hub.docker.com/r/239144498/streaming)\n[![GitHub stars](https://img.shields.io/github/stars/239144498/Streaming-Media-Server-Pro?color=brightgreen\u0026style=plastic\u0026logo=Apache%20Spark)](https://github.com/239144498/Streaming-Media-Server-Pro/stargazers)\n[![MIT license](https://img.shields.io/badge/license-GNU3.0-green.svg?style=plastic\u0026logo=React%20Hook%20Form)](https://github.com/239144498/Streaming-Media-Server-Pro/blob/main/LICENSE)\n\nDocumentation: [English version](https://github.com/239144498/Streaming-Media-Server-Pro/blob/main/README_EN.md) | 中文版\n\n\u003c/div\u003e\n\n[更新日志](https://github.com/239144498/Streaming-Media-Server-Pro/wiki/%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97)\n---\n\n- 我创建了`IPTV频道`群组，可供交流、测试、反馈， **加入可直接访问 [https://t.me/+QmBC4d4jtgo2M2M9](https://t.me/+QmBC4d4jtgo2M2M9) ，或者扫码加入：**\n\n\u003ca href=\"https://t.me/+QmBC4d4jtgo2M2M9\"\u003e\u003cimg src=\"https://ik.imagekit.io/naihe/github/img.png\" alt=\"stream.png\" border=\"0\" width=\"220px\" height=\"220px\" /\u003e\u003c/a\u003e\n\n\n\n目录\n-------------------\n- [项目树形图](#项目树形图)\n- [公益视频网站](#公益视频网站)\n- [核心功能](#核心功能)\n- [程序接口指南](#程序接口指南)\n- [播放效果](#播放效果)\n- [原理介绍](#原理介绍)\n- [文字详解](#文字详解)\n- [使用方式](#使用方式)\n  - [python部署:](#python部署)\n  - [安装依赖](#安装依赖)\n  - [运行](#运行)\n- [License](#License)\n\n项目树形图\n---\n\n```\n.\n├── app\n│   ├── __init__.py\n│   ├── main.py\n│   ├── log\n│   ├── api\n│   │   ├── __init__.py\n│   │   ├── a4gtv\n│   │   │   ├── __init__.py\n│   │   │   ├── endecrypt.py\n│   │   │   ├── generateEpg.py\n│   │   │   ├── tasks.py\n│   │   │   ├── tools.py\n│   │   │   └── utile.py\n│   │   └── v2\n│   │       ├── __init__.py\n│   │       └── endpoints\n│   │           ├── __init__.py\n│   │           ├── more.py\n│   │           └── sgtv.py\n│   ├── assets\n│   │   ├── EPG.xml\n│   │   ├── diyepg.txt\n│   ├── common\n│   │   ├── __init__.py\n│   │   ├── costum_logging.py\n│   │   ├── diyEpg.py\n│   │   ├── gitrepo.py\n│   │   └── header.py\n│   ├── conf\n│   │   ├── __init__.py\n│   │   ├── config.ini\n│   │   └── config.py\n│   ├── db\n│   │   ├── __init__.py\n│   │   ├── DBtools.py\n│   │   └── dbMysql.py\n│   └── scheams\n│       ├── __init__.py\n│       └── basic.py\n├── main.py\n├── requirements.txt\n├── Dockerfile\n├── README.md\n├── Procfile\n└── LICENSE\n\n```\n\n核心功能\n---\n\n- 高效流媒体（具有缓冲区）\n- 代理任意视频网站的视频流\n- 生成m3u文件\n- 生成m3u8文件\n- 异步下载流\n- 流媒体转发\n- 生成[EPG节目单](https://agit.ai/239144498/demo/raw/branch/master/4gtvchannel.xml) 每日实时更新\n- 分布式处理ts片\n- Redis缓存参数\n- MySql缓存数据\n- 正向代理请求\n- 自定义节目频道\n- 自定义电视台标\n- 自定义清晰度\n- 支持反向代理或使用CDN（负载均衡）\n\n程序接口指南\n---\n[https://stream.naihe.cf/docs](https://stream.naihe.cf/docs)  \n\u003cimg src=\"https://ik.imagekit.io/naihe/github/apilist.png\" title=\"api列表\"/\u003e\n\n播放效果\n---\n\n\u003cimg src=\"https://ik.imagekit.io/naihe/github/1.png\" title=\"播放效果\" alt=\"\"/\u003e\n\n\u003cimg height=\"600\" src=\"https://ik.imagekit.io/naihe/github/4.png\" title=\"节目单\u0026频道表\" alt=\"\"/\u003e\n\n原理介绍\n---\n如下图所示：\n\u003cimg src=\"https://ik.imagekit.io/naihe/github/%E5%8E%9F%E7%90%86%E7%A4%BA%E6%84%8F%E5%9B%BE.jpg\" title=\"原理图\"/\u003e\n\n文字详解\n---\n图中多台服务器是一种理想情况下实现，实际python程序、redis和mysql都可以在同一台服务器中实现\n- ① 客户端请求m3u8文件\n   - 1-\u003e 查看内存是否缓存，否则服务器执行图流程2\n   - 2-\u003e BackgroundTasks任务：执行图流程3，分布式下载数量根据设置的缓冲区大小决定\n    - 3\u003c- 返回m3u8文件\n- ② 客户端请求ts片\n   - 1-\u003e 查看本地是否缓存，否则服务器执行图流程2\n   - 2-\u003e BackgroundTasks任务：执行图流程3\n   - 3-\u003e 查看内存是否已下载完成状态，下载完执行图流程4，否则循环判断等待\n   - 4\u003c- 返回ts文件\n- ③ 还有很多技术细节就不一一展开，只列出以上部分  \n\n该项目根据分析4gtv网站的接口，通过算法得到生成ts视频的一些关键参数，省去请求网站从而得到m3u8文件的通信时长等开销，针对海外视频网站被墙隔离，支持以下几种观看方式：\n- 通过**具有缓冲区的中转服务**观看（调用api接口 /online.m3u8）\n- 通过**CDN**或**反向代理**观看（调用api接口 /channel.m3u8?\u0026host=xxx）\n- 使用**科学上网软件**观看（调用api接口 /channel2.m3u8）  \n\n使用方式\n---\n\u003e 💡提示：最好将本项目部署至美国地区的服务器，否则可能会出现奇怪的BUG。\n\n推荐大家使用[Digitalocean](https://www.digitalocean.com/?refcode=45e25f5e4569\u0026utm_campaign=Referral_Invite\u0026utm_medium=Referral_Program\u0026utm_source=badge)的服务器，主要是因为免费。\n\n\u003ca href=\"https://www.digitalocean.com/?refcode=45e25f5e4569\u0026utm_campaign=Referral_Invite\u0026utm_medium=Referral_Program\u0026utm_source=badge\"\u003e\u003cimg src=\"https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%201.svg\" alt=\"DigitalOcean Referral Badge\" /\u003e\u003c/a\u003e\n\n使用我的邀请链接注册，你可以获得$200的credit，当你在上面消费$25时，我也可以获得$25的奖励。\n\n我的邀请链接：\n\n[https://m.do.co/c/45e25f5e4569](https://m.do.co/c/45e25f5e4569)\n\u003e 根据以下通用命令部署本项目\n### python部署: \npython版本\u003e=3.8+\n``` code\ngit clone https://github.com/239144498/Streaming-Media-Server-Pro.git\n```\n### 安装依赖\n``` code\npip install -r requirements.txt\n```\n### 运行\n``` code\npython3 main.py\n```\n\n**（docker部署）更多使用教程详情 https://www.cnblogs.com/1314h/p/16651157.html**\n\n现已支持频道\n---\n- [x] 在diychannel.txt文件添加自定义频道\n\nLicense\n---\n[GNU-3.0 © naihe](https://github.com/239144498/Streaming-Media-Server-Pro/blob/main/LICENSE)\n\n","funding_links":["https://ik.imagekit.io/naihe/pay/hbm.jpg"],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfcx%2FStreaming-Media-Server-Pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfcx%2FStreaming-Media-Server-Pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfcx%2FStreaming-Media-Server-Pro/lists"}