mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-07-03 20:42:53 -05:00
[downloader/mhtml] Add new downloader (#343)
This downloader is intended to be used for streams that consist of a timed sequence of stand-alone images, such as slideshows or thumbnail streams This can be used for implementing: https://github.com/ytdl-org/youtube-dl/issues/4974#issue-58006762 https://github.com/ytdl-org/youtube-dl/issues/4540#issuecomment-69574231 https://github.com/ytdl-org/youtube-dl/pull/11185#issuecomment-335554239 https://github.com/ytdl-org/youtube-dl/issues/9868 https://github.com/ytdl-org/youtube-dl/pull/14951 Authored by: fstirlitz
This commit is contained in:
Notes:
pukkandan
2021-06-13 22:41:29 +05:30
This also adds extracting storyboards from DASH manifest as mhtml
@ -2244,6 +2244,17 @@ def unescapeHTML(s):
|
||||
r'&([^&;]+;)', lambda m: _htmlentity_transform(m.group(1)), s)
|
||||
|
||||
|
||||
def escapeHTML(text):
|
||||
return (
|
||||
text
|
||||
.replace('&', '&')
|
||||
.replace('<', '<')
|
||||
.replace('>', '>')
|
||||
.replace('"', '"')
|
||||
.replace("'", ''')
|
||||
)
|
||||
|
||||
|
||||
def process_communicate_or_kill(p, *args, **kwargs):
|
||||
try:
|
||||
return p.communicate(*args, **kwargs)
|
||||
@ -2323,13 +2334,14 @@ def decodeOption(optval):
|
||||
return optval
|
||||
|
||||
|
||||
def formatSeconds(secs, delim=':'):
|
||||
def formatSeconds(secs, delim=':', msec=False):
|
||||
if secs > 3600:
|
||||
return '%d%s%02d%s%02d' % (secs // 3600, delim, (secs % 3600) // 60, delim, secs % 60)
|
||||
ret = '%d%s%02d%s%02d' % (secs // 3600, delim, (secs % 3600) // 60, delim, secs % 60)
|
||||
elif secs > 60:
|
||||
return '%d%s%02d' % (secs // 60, delim, secs % 60)
|
||||
ret = '%d%s%02d' % (secs // 60, delim, secs % 60)
|
||||
else:
|
||||
return '%d' % secs
|
||||
ret = '%d' % secs
|
||||
return '%s.%03d' % (ret, secs % 1) if msec else ret
|
||||
|
||||
|
||||
def make_HTTPS_handler(params, **kwargs):
|
||||
|
Reference in New Issue
Block a user