/IPTV-M3U-Parser

This is a tool that allows users to scrape IPTV playlists, filter out unwanted channels, and generate a new playlist with only the desired channels.

Primary LanguagePython

IPTV M3U Parser

This is a Python script that can parse an IPTV M3U file, check connectivity, and extract accessible channels that match a set of specified channel names using regex pattern. Requirements

This script requires Python 3 and the requests module, which can be installed via pip:

pip install requests

Usage

To be able to use the script you need to provide first a wanted.txt file of your wanted channels, preferably by putting it in the same folder as the iptv-parser.py file.

The script can be executed from the command line with the following arguments:

-l or --local: Path of local M3U file (required if -r not provided)
-r or --remote: URL of remote M3U file (required if -l not provided)
-w or --wanted: Path to file containing channel names to extract (required, default: wanted.txt)
-o or --output: Output M3U file name (optional, default : m3u-input-filename_output.m3u)
-a or --accounts: Csv file name containing accounts playlists and info (optional, default : accounts.csv)

To execute the iptv-parser.py script with a local M3U file:

python iptv-parser.py -l path/to/local.m3u

or

python iptv-parser.py -l path/to/local.m3u -o path/to/output.m3u -w path/to/wanted.txt

To execute the script with a remote M3U file:

python iptv-parser.py -r http://remote.m3u

The script will read the specified channel names file, create a regex pattern, and use it to filter the channels from the M3U file. The accessible channels will be saved to the specified output file, and a list of accessible channels will be printed to the console.

Batch mode

It is also possible with batch.py to parse multiple links or m3u local files by providing a links.txt file

The batch.py script can be executed from the command line with the following arguments:

-l or --links: Path to the links file (optional, default: links.txt)
python batch.py -l links.txt

License

This code is released under the MIT License. See LICENSE file for details.

MIT License