A robust tool designed to validate and clean M3U playlists by verifying each channel's stream availability and removing any entries with invalid streams.
- Stream Validation: Automatically checks each channel's stream availability
- Rate Limiting Protection: Smart handling of rate limits with automatic backoff
- Slow Mode: Conservative request rates for more reliable validation
- Cleaning: Cleans and corrects malformed entries
- Aggressive Cleaning: Removes potentially dangerous characters completely
- Duplicate Removal: Identifies and removes duplicate channel entries
- Logging: Detailed logs of actions performed on the playlists
- Docker Integration: Packaged into a Docker container for easy deployment
pip install m3ucleangit clone https://github.com/samestrin/m3uclean.git
cd m3uclean
pip install -e .docker pull samestrin/m3ucleanOr build the Docker image yourself:
git clone https://github.com/samestrin/m3uclean.git
cd m3uclean
docker build -t m3uclean .# Basic usage
m3uclean input.m3u -o output.m3u
# With stream validation
m3uclean input.m3u -o output.m3u -v
# With stream validation in slow mode (recommended for large playlists)
m3uclean input.m3u -o output.m3u -v --slow
# With aggressive cleaning
m3uclean input.m3u -o output.m3u -a
# With custom log file
m3uclean input.m3u -o output.m3u -l logfile.log
# Full options
m3uclean input.m3u -o output.m3u -l logfile.log -v -a --slowdocker run -it --rm \
-e INPUT_FILE="/var/tmp/m3u/playlist.m3u" \
-e OUTPUT_FILE="/var/tmp/m3u/playlist_clean.m3u" \
-e LOG_FILE="/var/tmp/m3u/m3uclean.log" \
-e STREAM_VALIDATE="true" \
-e AGGRESSIVE_CLEAN="true" \
-v "/path/to/your/local/m3ufiles:/var/tmp/m3u" \
m3ucleanWhen using Docker, you can configure the application using the following environment variables:
INPUT_FILE: Path to the input M3U playlist fileOUTPUT_FILE: Path to the output M3U playlist fileLOG_FILE: Path to the log fileSTREAM_VALIDATE: Set to "true" to enable stream validationAGGRESSIVE_CLEAN: Set to "true" to enable aggressive cleaning
Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes or improvements.
This project is licensed under the MIT License - see the LICENSE file for details.