Skip to main content

M3U-Helper 用户指南

项目地址

pypi:https://pypi.org/project/m3u-helper-icexmoon/

Github:https://github.com/icexmoon/m3u-helper

用途

本应用主要用于帮助对m3u或m3u8文件进行相关处理,目前包括:检测链接有效性、排序、分组等。

注意事项

  • 对电视频道有效性的验证是通过调用requests模块的get请求实现的,所有在0.1秒内连接,并且http状态不是200的url被认为是有效的电视频道,否则视为无效。

  • 有效性验证使用futures模块实现多线程,目前线程池数目设置为10。

  • 需要注意的是,IPTV的网络通畅程度很大程度上是依赖于具体的电信运营商的,所以很可能不同的m3u电视频道源在不同的电信运营商或者不同的地域下的网络流畅程度是不同的,比如电信的用户可以但联通的用户不能观看,所以本程序应该和最终使用m3u文件进行观看IPTV的设备在同一网络下进行使用。

  • 本程序只是帮助自动化处理m3u文件,并不提供IPTV源。

  • 目前自动化分组和排序的功能相当初级,推荐先手动进行一定程度的修改,比如将#EXTINF:-1 ,CCTV1修改为#EXTINF:-1 ,CCTV01,这样能获得更好的排序结果。此外如果需要进一步优化排序和分组结果,可以在issues页面进行反馈。

  • 目前对m3u文件的解析使用的是m3u8包,经过测试发现该包只能正常解析未进行分组的原始m3u文件,比如:

    #EXTM3U
    #EXTINF:-1 ,CCTV01
    http://39.134.39.39/PLTV/88888888/224/3221226247/index.m3u8
    #EXTINF:-1 ,CCTV02
    http://39.134.39.39/PLTV/88888888/224/3221226220/index.m3u8
    

    如果在频道名称前附加了其它数据的,比如进行了分组的:

    #EXTM3U
    #EXTINF:-1 group-title="中央台",CCTV01
    http://39.134.39.39/PLTV/88888888/224/3221226247/index.m3u8
    #EXTINF:-1 group-title="中央台",CCTV02
    http://39.134.39.39/PLTV/88888888/224/3221226220/index.m3u8
    

    将无法正常解析,此问题可能会在后续迭代中进行解决。

  • 本程序需要Python运行环境,如果不知道如何安装,可以阅读windows下的python环境安装

安装

pip install m3u-helper-icexmoon

更新

pip install --upgrade m3u-helper-icexmoon

功能

已添加控制台短命令支持,所有功能均可以通过pymh快速调用。比如python -m m3u_helper -hpymh -h的效果完全一致。

输出帮助信息

pymh -h

格式化m3u文件

扫描当前工作目录下的所有m3u和m3u8文件,并生成相应的格式化后的文件,生成的文件将以_formated后缀作为文件名。

pymh

此命令可以结合多种可选参数,具体见功能>可选参数。

all-in-one

扫描工作目录下的所有m3u和m3u8文件,并会将其包含的频道进行合并后生成一个汇总后并且经过格式化的m3u文件:all_in_one_formated.m3u,无论之前有无此同名文件都将进行覆盖,所以请不要自己编写同名文件。

pymd -a

此命令可以结合多种可选参数,具体见功能>可选参数。

可选参数

  • -c --check_connect:验证链接有效性
  • -o --order:对结果进行排序
  • -n --no_print:不显示处理过程信息

在没有设置可选参数的情况下,程序的默认处理逻辑是“不验证链接有效性、不对结果进行排序、显示处理过程信息”。

可选参数进行组合使用,比如pymd -aco,效果为创建汇总m3u,并且对链接进行验证,对频道进行排序。

更新日志

0.0.1

创建应用。

Release files for m3u-helper-icexmoon 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m3u-helper-icexmoon 0.0.2
File Size Uploaded
m3u-helper-icexmoon-0.0.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for m3u-helper-icexmoon 0.0.2
File Interpreter ABI Platform
m3u_helper_icexmoon-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / m3u-helper-icexmoon-0.0.2.tar.gz

Download URL m3u-helper-icexmoon-0.0.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
79ef8b27e283cf684c370f69269121bcadf40bc7252e4050ca61f790e1a1fba4
BLAKE2b-256 checksum
How to use checksums
9ec2dd2f16afc56faa1ab13446d5550f082d2389868921ba53a209f08c060bc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

Release files / m3u_helper_icexmoon-0.0.2-py3-none-any.whl

Download URL m3u_helper_icexmoon-0.0.2-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2aa3e0478e4fb3d489cc5afec3f5dd86c21dedb262d7fbd3704381e26dc920d
BLAKE2b-256 checksum
How to use checksums
3e92f256d001831b0a407f8cd3e74ac191ca162450918eb5b815f48f06c6502f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page