akaramires / m3u-parser
1.0.2
2024-04-09 14:41 UTC
Requires
- php: ^8.1
- spatie/laravel-data: 4.5
Requires (Dev)
- phpunit/phpunit: 10.*
This package is auto-updated.
Last update: 2024-11-09 16:11:51 UTC
README
Теги, поддерживаемые парсером:
- #EXTM3U
- #EXTENC
- #PLAYLIST
- #EXT-X-PLAYLIST-TYPE
- #EXT-X-TARGETDURATION
- #EXT-X-VERSION
- #EXT-X-MEDIA-SEQUENCE
- #EXT-X-ALLOWCACHE
- #EXT-X-MAP
- #EXT-X-START
- #EXT-X-ENDLIST
- #EXTINF
- #EXT-X-PROGRAM-DATE-TIME
- #EXTGRP
- #EXTLOGO
- #EXTVLCOPT
- #EXT-X-DISCONTINUITY
- #EXT-X-BYTERANGE
Пример использования:
use Akaramires\M3uParser\Processors\PlaylistProcessor; use Akaramires\M3uParser\Sources\FileSource; ... $source = new FileSource(__DIR__ . '/../Data/playlist.m3u'); /** @var PlaylistProcessor $processor */ $processor = app(PlaylistProcessor::class); $processor->load($source); $processor->parse(); $playlist = $processor->getPlaylist();
Пример ответа:
[ "inlineAttributes" => [ [ "key" => "cache", "value" => "500", ], [ "key" => "playlist", "value" => "1", ], ], "attributes" => [], "attributesWithoutValue" => [], "channels" => [ [ "title" => "TVMatic Comedy", "duration" => "0", "url" => "https://iptv.com/channel.m3u8", "inlineAttributes" => [ [ "key" => "tvg-country", "value" => "es", ], [ "key" => "group-title", "value" => "Spain", ], ], "attributes" => [], ] [ "title" => "TVMatic Comedy 2", "duration" => "0", "url" => "https://iptv.com/channel.m3u8", "inlineAttributes" => [], "attributes" => [], ], ],