From 4761dbc20e172101b99fde3cf0061e311e89de5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Wed, 15 Jan 2020 10:43:10 +0100 Subject: [PATCH] [televizeseznam] append width and height if resolution field exists --- youtube_dl/extractor/televizeseznam.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/televizeseznam.py b/youtube_dl/extractor/televizeseznam.py index dd99f9e5b..c911c6fb6 100644 --- a/youtube_dl/extractor/televizeseznam.py +++ b/youtube_dl/extractor/televizeseznam.py @@ -52,15 +52,18 @@ class TelevizeSeznamIE(InfoExtractor): def extract_formats(self, spl_url, play_list, subtitles): formats = [] for r, v in play_list.items(): - formats.append({ + format = { 'format_id': r, - 'url': urljoin(spl_url, v['url']), - 'width': v['resolution'][0], - 'height': v['resolution'][1], + 'url': urljoin(spl_url, v.get('url')), 'protocol': 'https', 'ext': 'mp4', 'subtitles': subtitles, - }) + } + if v.get('resolution'): + format.update({ 'width': v['resolution'][0], 'height': v['resolution'][1] }) + + formats.append(format) + return formats def _real_extract(self, url):