diff options
author | Remita Amine <remitamine@gmail.com> | 2020-12-02 21:37:14 +0100 |
---|---|---|
committer | nixxo <nixxo@protonmail.com> | 2020-12-03 13:10:24 +0100 |
commit | 082703347946949a93814f62e783cddf80d41482 (patch) | |
tree | 35f4d93fc446797c6cbf8d58d3d856e289f5a75e | |
parent | 98e248faa49e69d795abc60f7cdefcf91e2612aa (diff) | |
download | hypervideo-pre-082703347946949a93814f62e783cddf80d41482.tar.lz hypervideo-pre-082703347946949a93814f62e783cddf80d41482.tar.xz hypervideo-pre-082703347946949a93814f62e783cddf80d41482.zip |
[extractor/common] improve Akamai HTTP format extraction
- Allow m3u8 manifest without an additional audio format
- Fix extraction for qualities starting with a number
Solution provided by @nixxo based on: https://stackoverflow.com/a/5984688
-rw-r--r-- | youtube_dlc/extractor/common.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/youtube_dlc/extractor/common.py b/youtube_dlc/extractor/common.py index aacdf06fe..a56465956 100644 --- a/youtube_dlc/extractor/common.py +++ b/youtube_dlc/extractor/common.py @@ -2624,7 +2624,7 @@ class InfoExtractor(object): REPL_REGEX = r'https://[^/]+/i/([^,]+),([^/]+),([^/]+).csmil/.+' qualities = re.match(REPL_REGEX, m3u8_url).group(2).split(',') qualities_length = len(qualities) - if len(formats) in (qualities_length + 1, qualities_length * 2 + 1): + if len(formats) in (qualities_length, qualities_length + 1, qualities_length * 2, qualities_length * 2 + 1): i = 0 http_formats = [] for f in formats: @@ -2633,7 +2633,7 @@ class InfoExtractor(object): http_f = f.copy() del http_f['manifest_url'] http_url = re.sub( - REPL_REGEX, protocol + r'://%s/\1%s\3' % (http_host, qualities[i]), f['url']) + REPL_REGEX, protocol + r'://%s/\g<1>%s\3' % (http_host, qualities[i]), f['url']) http_f.update({ 'format_id': http_f['format_id'].replace('hls-', protocol + '-'), 'url': http_url, |