M3U / M3U8 Playlist Parser
Parse an M3U or M3U8 playlist into track entries.
Overview
The M3U / M3U8 playlist parser takes a .m3u or .m3u8 file and returns a structured list of every track entry — duration, title, URL or path, and any inline metadata directives. It works on both the original Winamp-era playlist format and the extended HLS streaming variant used by Apple's live and on-demand video.
Media library managers, podcasting integrators, and streaming-service developers reach for this when a hand-written or programmatically generated playlist needs validation or transformation. Long-tail searches that lead here include "parse M3U playlist online", "extract URLs from M3U8 file", and "read HLS playlist entries".
How it works
A bare M3U is a plain-text list, one resource path or URL per line. The extended M3U format (the version most apps actually use) prefixes the file with #EXTM3U and precedes every entry with #EXTINF:duration,title, where the duration is in seconds (-1 for unknown) and the title is free-form. The parser walks the file line by line, collecting an EXTINF line into the next non-comment line that follows it as a single entry.
For HLS .m3u8 files, the parser also recognises tags from RFC 8216: #EXT-X-VERSION, #EXT-X-TARGETDURATION, #EXTINF, #EXT-X-BYTERANGE, segment URLs, and #EXT-X-ENDLIST. Stream variant playlists with #EXT-X-STREAM-INF entries are surfaced with their bandwidth and resolution attributes.
Examples
- Extract every audio file URL from a long radio-station M3U for batch downloading.
- Validate that a generated podcast playlist's durations are sensible (no
-1or wildly inflated values). - Inspect an HLS master playlist to see which variant bitrates are advertised.
- Convert a playlist of relative paths into absolute URLs for embedding in a player.
FAQ
What is the difference between M3U and M3U8?
M3U is historically Latin-1; M3U8 is the same format declared to be UTF-8. Modern usage treats M3U8 as the unambiguous, Unicode-safe variant — and HLS uses M3U8 exclusively.
Does the parser fetch the entries?
No. It only parses the playlist text. Resolving and downloading the referenced media is a separate step.
Can it tell me total playlist duration?
Yes — durations from #EXTINF lines are summed, ignoring unknown (-1) entries.
Are comments allowed?
Any line beginning with # that is not a recognised directive is treated as a comment and skipped, matching the lenient parsing real-world players perform.
What if the playlist is malformed?
Entries missing their #EXTINF line are still surfaced as untitled tracks rather than dropped silently, so you can spot the issue and fix the source.