PHP Simple M3U Parser, it clean the playlist and remove duplicate

Overview

SimpleM3UParser

PHP Simple M3U Playlist Parser, it clean, remove duplicate, and group the playlist.

Usage

see example.php

<?php
require_once  "M3UParser.php";

# open from file
$m3u = file_get_contents("playlist.m3u");

# open from url
# $m3u = 'http://localhost/play.m3u';

# open multiple url
/*
$m3u = array(
    'http://localhost/a.m3u',
    'http://localhost/b.m3u',
    'http://localhost/c.m3u',
);
*/

$parser = new  M3UParser($m3u);
echo  $parser->text();

Available Functions

  • $parser->text() return cleaned m3u
  • $parser->list() return array of playlist group
  • $parser->getGroup() return playlist group names
  • $parser->getDuplicateURL() return duplicate URLs

Example Dirty M3U Playlist

#EXTM3U

#EXTINF:-1 tvg-logo="https://png" group-title="Sport", WWE UK
http://localhost/index.m3u8

#EXTINF:-1 group-title="Sport", WWE US ( no source http, will be removed)
#EXTINF:-1 tvg-logo="https://colorLogoPNG.png" group-title="Sports", MLB


http://localhost/mlb.m3u8

# ( Duplicate URL, will be removed)
#EXTINF:-1 tvg-logo="https://png" group-title="Sport", WWE UK
http://localhost/index.m3u8

#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha

#KODIPROP:inputstream.adaptive.license_key=https://localhost


#EXTINF:-1 group-title="Entertaiment" tvg-logo="http://tlc.png", TLC

https://localhost/dash.mpd

Cleaned M3U Playlist

#EXTM3U

#EXTINF:-1 tvg-logo="https://png" group-title="Sport", WWE UK
http://localhost/index.m3u8

#EXTINF:-1 tvg-logo="https://colorLogoPNG.png" group-title="Sports", MLB
http://localhost/mlb.m3u8

#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://localhost
#EXTINF:-1 group-title="Entertaiment" tvg-logo="http://tlc.png", TLC
https://localhost/dash.mpd
You might also like...
Test and enforce architectural rules in your Laravel applications. Keep your app's architecture clean and consistent!
Test and enforce architectural rules in your Laravel applications. Keep your app's architecture clean and consistent!

Laravel Arkitect Laravel Arkitect lets you test and enforce your architectural rules in your Laravel applications, and it's a PHPArkitect wrapper for

Clean Architecture, DDD and CQRS using Symfony 6

Task manager system using Clean Architecture, DDD and CQRS. Environment setup Install Docker Clone the project: git clone https://github.com/k0t9i/Tas

Clean Code concepts adapted for PHP

Clean Code PHP Table of Contents Introduction Variables Use meaningful and pronounceable variable names Use the same vocabulary for the same type of v

Clean Code concepts adapted for PHP

PHP Temiz Kod İçindekiler Giriş Değişkenler Anlamlı ve telaffuz edilebilir değişken isimleri kullanın Aynı türden değişkenler için aynı kelimeleri kul

Conceptos de Clean Code adaptados para PHP

Clean Code PHP Traducción al español de Clean Code PHP realizado por Jupeter. Si encuentras un error de ortografía, de redacción o de traducción; no d

my personal example of Laravel clean architecture

what is this repo about Clean Architect Laravel ###run we assume docker desktop is up and running open up a terminal cd project directory run "cp .env

A PocketMine-MP plugin that can reduce or clean up the chunks in your world

AutoClearChunk A PocketMine-MP plugin that can reduce or clean up the chunks in your world Features Custom Clear Message Custom Clear Interval Time Pe

POC d'un projet Clean Architecture + DDD

Proof Of Concept - Clean Architecture & DDD Installation Dans un premier temps, cloner le repository : git clone https://github.com/TBoileau/rse cd rs

A collection of functions to clean up WordPress

Clean WordPress Admin A collection of functions to clean up WordPress front and back-end to make it easier for editors to work and for you to look at

Owner
erwin solihin
erwin solihin
A Magento 2 module that allows admins to duplicate CMS blocks and pages from their respective grids and en masse.

element119 | CMS Duplicator ?? Features ✔️ Allows merchants to duplicate CMS blocks and pages from the Action column in the admin grid ✔️ Allows merch

Kiel Pykett 13 Oct 13, 2022
Compares two directories and removes the duplicate files from the second directory.

How does the HRZ Duplicate Refiner work? 1- Compares two directories : patternDir: the directory used as the pattern & does not change. victimDir: A d

Hamidreza Zolfaghar 2 May 6, 2022
Documentation on clean coding and demonstration of studied clean coding principals with PHP.

practice-php-clean-code Documentation on clean coding and demonstration of studied clean coding principals with PHP. The document contained in this re

Ferdous Islam 1 Feb 21, 2022
StickWithIt is an online food ordering website created using PHP. You can view and purchase various items as well as remove items from the cart.

StickWithIt (App Name) StickWithIt is an online food ordering website created using PHP. The database used here is MYSQL database. The tool used here

Jenil Gajjar 1 May 11, 2022
Library allows to detect emoji, remove emoji, encode emoji and decode emoji in string.

It allows to detect emoji, remove emoji, encode emoji and decode emoji in string. Installation composer require anisimov/emoji How to use Encode and

Aleksey Anisimov 9 Nov 8, 2022
Tool to remove code based on specific comments.

PHP-DEL Tool to remove code based on specific comments. Configuration Create php-del.json in the root directory of the project { "dirs": [ "src"

KenjiroKubota 16 Dec 25, 2022
This plugin help us to remove the unused file or directories in vendor

Composer Ignore Plugin This plugin help us to remove the unused file or directories in vendor. Installation Both global or local install can work well

__FresHmaN 21 Oct 21, 2021
DBML parser for PHP8. It's a PHP parser for DBML syntax.

DBML parser written on PHP8 DBML (database markup language) is a simple, readable DSL language designed to define database structures. This page outli

Pavel Buchnev 32 Dec 29, 2022
A super simple, clean and pretty error handler that replace the default error handler of PHP. You need only include this file!

php-custom-error-handler A super simple, clean and pretty error handler that replace the default error handler of PHP. You need just include only this

null 6 Nov 7, 2022
Clean Code concepts adapted for PHP - A guide for producing readable, reusable, and refactorable PHP software

Clean Code concepts adapted for PHP - A guide for producing readable, reusable, and refactorable PHP software

Fabio Soares 172 Dec 25, 2022