m3u8
Python m3u8 parser
What it is and what it does
m3u8 is a Python parser for m3u8 playlist files, the manifest format used by HTTP Live Streaming (HLS). It reads m3u8 content from URLs, file paths, or strings and exposes the parsed structure as Python objects—segments, duration, media sequences, encryption keys, and dozens of other HLS tags. You can also serialize playlists back to m3u8 text format, making it useful for reading, modifying, and regenerating HLS manifests.
The package supports a large set of m3u8 tags defined in RFC 8216 and related HLS specifications, including basic playback metadata (#EXT-X-TARGETDURATION, #EXTINF), encryption (#EXT-X-KEY), adaptive streaming (#EXT-X-STREAM-INF), and newer extensions like partial segments (#EXT-X-PART) and content steering. Its only runtime dependency is backports-datetime-fromisoformat, and it requires Python 3.7 or later.
Use it for:
- Parse HLS manifests from a video streaming server to extract segment URLs and playback metadata for custom player logic
- Modify an existing m3u8 playlist (e.g., update encryption keys or segment paths) and write it back to a file
- Extract timing and duration information from live or on-demand HLS streams for analytics or scheduling
- Build tooling to validate or audit m3u8 playlists for compliance with HLS specifications
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses and generates m3u8 playlist files (HLS manifests) according to RFC 8216, supporting a comprehensive set of m3u8 tags and allowing you to load playlists from URLs, files, or strings and serialize them back to text.
Yes, if you need to work with m3u8 playlists. The package is stable, permissively licensed, has low install friction, and covers a comprehensive set of HLS tags. Maintenance is dormant but not abandoned; the last release was 2024-08-07 and the repository shows recent activity. No known vulnerabilities.
Install
m3u8 on PyPI
pip
pip install m3u8uv
uv add m3u8poetry
poetry add m3u8Installing m3u8
Before you install
Low install friction; depends only on backports-datetime-fromisoformat. Maintenance is dormant (737 days since last release), though the repository remains active with a recent commit on 2025-01-31 and 2276 stars.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
import m3u8
# Load from URL or file
playlist = m3u8.load('http://videoserver.com/playlist.m3u8')
print(playlist.segments)
print(playlist.target_duration)
# Or load from string
playlist = m3u8.loads('#EXTM3U\n#EXT-X-VERSION:3\n#EXTINF:10.0,\nsegment.ts')
# Dump back to file
playlist.dump('output.m3u8')
Verify before relying
- Whether the package handles all modern HLS extensions beyond RFC 8216 in practice, or if some listed tags have incomplete implementation
- Performance characteristics when parsing large or deeply nested playlists
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — backports-datetime-fromisoformat |
| Maintenance | dormant — 737 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,580,268/month — #3,741 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: m3u8-6.0.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
webvtt-pyReads, writes, and segments WebVTT caption…
permissive · top 5,000 on PyPI
icalParse, create, and iterate over iCalendar (RFC…
permissive · top 15,000 on PyPI
streamlinkStreamlink extracts video streams from various…
permissive · top 15,000 on PyPI
sexpdataParses and serializes S-expressions (Lisp-style…
permissive · top 15,000 on PyPI
mwxmlEfficiently parse and stream-process MediaWiki…
permissive · top 15,000 on PyPI
spotdlspotDL downloads songs from Spotify playlists…
permissive · top 15,000 on PyPI
lazr.uriParse, manipulate, and generate URIs with a…
copyleft · top 15,000 on PyPI
git-url-parseParses Git repository URLs to extract…
permissive · top 15,000 on PyPI
mediatypeParses and creates MIME types (media types)…
permissive · top 15,000 on PyPI
ytmusicapiytmusicapi lets you programmatically interact…
permissive · top 15,000 on PyPI