Files
iptv-collector-20260928221845/README.md
T

84 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IPTV Collector
自动采集央视、卫视、地方台等IPTV频道,生成标准的M3U播放列表,支持每日定时更新。
## 功能特性
- 从多个公开源采集频道信息
- 自动分类:央视、卫视、地方台
- 生成标准M3U格式播放列表
- 支持每日自动更新(通过cron或内置调度)
- 简洁实用,易于扩展
## 目录结构
```
iptv-collector/
├── collector.py # 主采集脚本
├── config.py # 配置文件
├── requirements.txt # 依赖
├── output/ # 输出目录(自动生成)
│ └── iptv.m3u # 生成的播放列表
└── README.md
```
## 安装
```bash
pip install -r requirements.txt
```
## 使用
### 单次采集
```bash
python collector.py
```
生成的文件位于 `output/iptv.m3u`。
### 每日自动更新
#### 方式一:使用cron(Linux/macOS)
```bash
# 每天凌晨2点执行
0 2 * * * cd /path/to/iptv-collector && python collector.py >> collector.log 2>&1
```
#### 方式二:使用内置调度(需安装schedule)
```bash
python collector.py --daemon
```
### 自定义配置
编辑 `config.py` 可修改:
- 采集源URL
- 输出路径
- 请求超时时间
- 用户代理
## 输出格式
生成的M3U文件示例:
```
#EXTM3U
#EXTINF:-1 tvg-name="CCTV-1" group-title="央视",CCTV-1 综合
http://example.com/cctv1.m3u8
...
```
## 注意事项
- 采集源为公开网络资源,请遵守相关法律法规
- 部分源可能失效,脚本会自动过滤无效链接
- 建议定期检查更新日志
## 许可证
MIT