Package: 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.InstallationTo install m3u8downloader, simply:$sudoaptinstall-yffmpeg$pipinstall--userm3u8downloaderQuick StartExample command line usage:downloadm3u8-o~/Downloads/foo.mp4https://example.com/path/to/foo.m3u8If ~/.local/bin is not in $PATH, you can use full path:~/.local/bin/downloadm3u8-o~/Downloads/foo.mp4https://example.com/path/to/foo.m3u8Here is built-in command line help:usage:m3u8downloader[-h][--user-agentUSER_AGENT][--originORIGIN][--version][--debug]--outputOUTPUT[--tempdirTEMPDIR][--concurrencyN]URLdownloadvideoatm3u8urlpositionalarguments:URLthem3u8urloptionalarguments:-h,--helpshowthishelpmessageandexit--user-agentUSER_AGENTspecifyUser-AgentheaderforHTTPrequests--originORIGINspecifyOriginheaderforHTTPrequests--versionshowprogram'sversionnumberandexit--debugenabledebuglog--outputOUTPUT,-oOUTPUToutputvideofilename,e.g.~/Downloads/foo.mp4--tempdirTEMPDIRtempdir,usedtostore.tsfilesbeforecombingthemintomp4--concurrencyN,-cNnumberoffragmentstodownloadatatimeDocumentationConfig File SupportYou may use a config file to specify some command line arguments.supported config files, later takes precedence:/etc/m3u8downloader.conf/etc/m3u8downloader/m3u8downloader.conf~/.config/m3u8downloader.conf~/.config/m3u8downloader/m3u8downloader.confconfig file format# comments and empty lines are ignored.KEY=VALUE# orKEY="VALUE"# boolean values may be true|false|yes|no|1|0supported keys:user_agent=<string>origin=<string>tempdir=<string>concurrency=<int>debug=<true|false>Their meaning is the same as their counterpart in command line arguments.if a config is specified both in config file and command line arguments,
command line arguments will take precedence.LimitationsThis 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.ChangeLogv0.10.1lifted lib version restrictionv0.10.0add support for config filehandle Ctrl+C and SIGTERM properlyv0.9.0add support for –user-agent and –origin parametersv0.8.7bugfix: do not rewrite KEY URI if it is already a local file path.v0.8.6fix 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.4minor 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.3bugfix: ensure output file name and temp dir name is always valid for
windows platform.v0.8.1bugfix: should rewrite key uri to local file path.some bugfix for windows platform.v0.8.0 2019-03-31add logrotate for log handlerv0.7.8 2019-03-09bugfix: fragment url rewrite fail for some casesv0.7.7 2019-03-08bugfix: always rewrite fragment url to local abs pathv0.7.5 2019-03-07set default log level to INFOv0.7.4 2019-03-07initial release