Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/globocom/m3u8
Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
https://github.com/globocom/m3u8
hls m3u8 parser python
Last synced: 2 days ago
JSON representation
Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
- Host: GitHub
- URL: https://github.com/globocom/m3u8
- Owner: globocom
- License: other
- Created: 2012-04-27T20:56:32.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-11-11T15:45:02.000Z (about 1 month ago)
- Last Synced: 2024-11-25T20:04:10.053Z (17 days ago)
- Topics: hls, m3u8, parser, python
- Language: Python
- Homepage:
- Size: 612 KB
- Stars: 2,066
- Watchers: 146
- Forks: 475
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesomeLibrary - m3u8 - Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions. (语言资源库 / python)
- awesome-video - m3u8 - Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions. (Language and platform specific libraries / Python)
- awesome-video - globocom/m3u8 - M3U8 library (HLS / Talks Presentations Podcasts)
README
![image](https://github.com/globocom/m3u8/actions/workflows/main.yml/badge.svg) [![image](https://badge.fury.io/py/m3u8.svg)](https://badge.fury.io/py/m3u8)
# m3u8
Python [m3u8](https://tools.ietf.org/html/rfc8216) parser.
# Documentation
## Loading a playlist
To load a playlist into an object from uri, file path or directly from
string, use the `load/loads` functions:```python
import m3u8playlist = m3u8.load('http://videoserver.com/playlist.m3u8') # this could also be an absolute filename
print(playlist.segments)
print(playlist.target_duration)# if you already have the content as string, use
playlist = m3u8.loads('#EXTM3U8 ... etc ... ')
```## Dumping a playlist
To dump a playlist from an object to the console or a file, use the
`dump/dumps` functions:``` python
import m3u8playlist = m3u8.load('http://videoserver.com/playlist.m3u8')
print(playlist.dumps())# if you want to write a file from its content
playlist.dump('playlist.m3u8')
```# Supported tags
- [\#EXT-X-TARGETDURATION](https://tools.ietf.org/html/rfc8216#section-4.3.3.1)
- [\#EXT-X-MEDIA-SEQUENCE](https://tools.ietf.org/html/rfc8216#section-4.3.3.2)
- [\#EXT-X-DISCONTINUITY-SEQUENCE](https://tools.ietf.org/html/rfc8216#section-4.3.3.3)
- [\#EXT-X-PROGRAM-DATE-TIME](https://tools.ietf.org/html/rfc8216#section-4.3.2.6)
- [\#EXT-X-MEDIA](https://tools.ietf.org/html/rfc8216#section-4.3.4.1)
- [\#EXT-X-PLAYLIST-TYPE](https://tools.ietf.org/html/rfc8216#section-4.3.3.5)
- [\#EXT-X-KEY](https://tools.ietf.org/html/rfc8216#section-4.3.2.4)
- [\#EXT-X-STREAM-INF](https://tools.ietf.org/html/rfc8216#section-4.3.4.2)
- [\#EXT-X-VERSION](https://tools.ietf.org/html/rfc8216#section-4.3.1.2)
- [\#EXT-X-ALLOW-CACHE](https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-07#section-3.3.6)
- [\#EXT-X-ENDLIST](https://tools.ietf.org/html/rfc8216#section-4.3.3.4)
- [\#EXTINF](https://tools.ietf.org/html/rfc8216#section-4.3.2.1)
- [\#EXT-X-I-FRAMES-ONLY](https://tools.ietf.org/html/rfc8216#section-4.3.3.6)
- [\#EXT-X-BITRATE](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.8)
- [\#EXT-X-BYTERANGE](https://tools.ietf.org/html/rfc8216#section-4.3.2.2)
- [\#EXT-X-I-FRAME-STREAM-INF](https://tools.ietf.org/html/rfc8216#section-4.3.4.3)
- [\#EXT-X-IMAGES-ONLY](https://github.com/image-media-playlist/spec/blob/master/image_media_playlist_v0_4.pdf)
- [\#EXT-X-IMAGE-STREAM-INF](https://github.com/image-media-playlist/spec/blob/master/image_media_playlist_v0_4.pdf)
- [\#EXT-X-TILES](https://github.com/image-media-playlist/spec/blob/master/image_media_playlist_v0_4.pdf)
- [\#EXT-X-DISCONTINUITY](https://tools.ietf.org/html/rfc8216#section-4.3.2.3)
- \#EXT-X-CUE-OUT
- \#EXT-X-CUE-OUT-CONT
- \#EXT-X-CUE-IN
- \#EXT-X-CUE-SPAN
- \#EXT-OATCLS-SCTE35
- [\#EXT-X-INDEPENDENT-SEGMENTS](https://tools.ietf.org/html/rfc8216#section-4.3.5.1)
- [\#EXT-X-MAP](https://tools.ietf.org/html/rfc8216#section-4.3.2.5)
- [\#EXT-X-START](https://tools.ietf.org/html/rfc8216#section-4.3.5.2)
- [\#EXT-X-SERVER-CONTROL](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.8)
- [\#EXT-X-PART-INF](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.7)
- [\#EXT-X-PART](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.9)
- [\#EXT-X-RENDITION-REPORT](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.5.4)
- [\#EXT-X-SKIP](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.5.2)
- [\#EXT-X-SESSION-DATA](https://tools.ietf.org/html/rfc8216#section-4.3.4.4)
- [\#EXT-X-PRELOAD-HINT](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.5.3)
- [\#EXT-X-SESSION-KEY](https://tools.ietf.org/html/rfc8216#section-4.3.4.5)
- [\#EXT-X-DATERANGE](https://tools.ietf.org/html/rfc8216#section-4.3.2.7)
- [\#EXT-X-GAP](https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-05#section-4.4.2.7)
- [\#EXT-X-CONTENT-STEERING](https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-10#section-4.4.6.64)# Frequently Asked Questions
- [FAQ](https://github.com/globocom/m3u8/wiki/FAQ)
# Running Tests
``` bash
$ ./runtests
```# Contributing
All contributions are welcome, but we will merge a pull request if, and
only if, it- Has tests
- Follows the code conventionsIf you plan to implement a new feature or something that will take more
than a few minutes, please open an issue to make sure we don't work on
the same thing.