diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2018-09-01 00:45:36 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2018-09-01 00:45:36 +0200 |
commit | 2b83da246375e6b37884aad9fe22ea8e461e20b3 (patch) | |
tree | 4a0aa4f6ef70858826fded3f11fb6589b49c7950 | |
parent | c1a37eb24a78fe07a3ad41fc151389e444b7962b (diff) |
[ard] Better format handling
Skip f4m, doesn't work (yet); correctly extract m3u8, and prefer plain HTTP files.
-rw-r--r-- | youtube_dl/extractor/ard.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/youtube_dl/extractor/ard.py b/youtube_dl/extractor/ard.py index 9c6be2dd9..cff8ca4a5 100644 --- a/youtube_dl/extractor/ard.py +++ b/youtube_dl/extractor/ard.py @@ -335,10 +335,24 @@ class ARDBetaMediathekIE(InfoExtractor): 'url': widget['_subtitleUrl'], }]} if '_quality' in widget: - formats.append({ - 'format_id': widget['_quality'], - 'url': widget['_stream']['json'][0], - }) + format_url = widget['_stream']['json'][0] + + if format_url.endswith('.f4m'): + # Skip f4m - these URLs just return a 403 + formats.append({ + 'format_id': 'f4m-' + widget['_quality'], + 'url': format_url, + 'preference': -1001, + }) + elif format_url.endswith('m3u8'): + formats.extend(self._extract_m3u8_formats( + format_url, video_id, 'mp4', m3u8_id='hls', fatal=False)) + else: + formats.append({ + 'format_id': 'http-' + widget['_quality'], + 'url': format_url, + 'preference': 10, # Plain HTTP, that's nice + }) self._sort_formats(formats) res['formats'] = formats |