Skip to main content

m3u8downloader

m3u8downloader is a tool to download video at a m3u8 link. HTTP Live Streaming (HLS) is becoming popular. m3u8 playlist is used by HLS to serve video fragments of different quality to different clients. This tool supports HLS master playlist and media playlist. If master playlist is given, it selects the highest resolution automatically. HLS fragment encryption is supported. Resume from partial download is supported, just rerun the same command to continue.

ffmpeg is used to convert the downloaded fragments into final mp4 video file.

Installation

To install m3u8downloader, simply:

$ sudo apt install -y ffmpeg
$ pip install --user m3u8downloader

Quick Start

Example command line usage:

downloadm3u8 -o ~/Downloads/foo.mp4 https://example.com/path/to/foo.m3u8

If ~/.local/bin is not in $PATH, you can use full path:

~/.local/bin/downloadm3u8 -o ~/Downloads/foo.mp4 https://example.com/path/to/foo.m3u8

Here is built-in command line help:

usage: m3u8downloader [-h] [--version] [--debug] --output OUTPUT
                      [--tempdir TEMPDIR] [--concurrency N]
                      URL

download video at m3u8 url

positional arguments:
  URL                   the m3u8 url

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --debug               enable debug log
  --output OUTPUT, -o OUTPUT
                        output video filename, e.g. ~/Downloads/foo.mp4
  --tempdir TEMPDIR     temp dir, used to store .ts files before combing them
                        into mp4
  --concurrency N, -c N
                        number of fragments to download at a time

Documentation

This command line tool doesn’t have extra documents.

Limitations

This tool only parses minimum m3u8 extensions for selecting media playlist from master playlist, downloading key and fragments from media playlist. If a m3u8 file doesn’t download correctly, it’s probably some new extension was added to the HLS spec which this tool isn’t aware of.

ChangeLog

  • v0.9.0

    • add support for –user-agent and –origin parameters

  • v0.8.7

    • bugfix: do not rewrite KEY URI if it is already a local file path.

  • v0.8.6

    • fix a regression in v0.8.4. the v0.8.4 release should be avoided. Either use v0.8.3 or v0.8.6+

  • v0.8.4

    • minor bugfix: still try rewrite path when using m3u8 file from cache. when rewrite path in m3u8 file, do not rewrite if path has already been rewritten before. This is a minor change, it only fix things when process is killed when .m3u8 file is downloaded but path in it has not been rewritten yet.

  • v0.8.3

    • bugfix: ensure output file name and temp dir name is always valid for windows platform.

  • v0.8.1

    • bugfix: should rewrite key uri to local file path.

    • some bugfix for windows platform.

  • v0.8.0 2019-03-31

    • add logrotate for log handler

  • v0.7.8 2019-03-09

    • bugfix: fragment url rewrite fail for some cases

  • v0.7.7 2019-03-08

    • bugfix: always rewrite fragment url to local abs path

  • v0.7.5 2019-03-07

    • set default log level to INFO

  • v0.7.4 2019-03-07

    • initial release

Metadata

Release files for m3u8downloader 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m3u8downloader 0.9.0
File Size Uploaded Provenance Actions
m3u8downloader-0.9.0.tar.gz 9.9 kB Without provenance Details for m3u8downloader-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for m3u8downloader 0.9.0
File Interpreter ABI Platform Actions
m3u8downloader-0.9.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for m3u8downloader-0.9.0-py2.py3-none-any.whl

Total release size: 22.3 kB

Release files / m3u8downloader-0.9.0.tar.gz

Download URL m3u8downloader-0.9.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
638cac1f25cc3b858c90a29675e08f76e42c147df17a7596bb62f54501e68b33
BLAKE2b-256 checksum
How to use checksums
fe6848edb352dc96be23ba53d7f8705894ce1afede07e81398f4ed6ce8a5d4d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Release files / m3u8downloader-0.9.0-py2.py3-none-any.whl

Download URL m3u8downloader-0.9.0-py2.py3-none-any.whl
Size 12.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
788b479592fecc07371c9b0a5e8ca11b7c2fda421e0f625441b73cf266d567b9
BLAKE2b-256 checksum
How to use checksums
0ab4104303dd6135673d54e5f957778932579ecd467640c423157bcad4c40699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Security for m3u8downloader 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page