aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/zdf.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-07-21 19:08:28 +0700
committerSergey M․ <dstftw@gmail.com>2018-07-21 19:08:28 +0700
commit3052a30d4259b182904e5d2430077039461745bb (patch)
tree90ff37fa326c33aff3ad82cd40a2f3ce856ee65b /youtube_dl/extractor/zdf.py
parent4ecf300d13a6503ae80b76e01047b41d86ab4d92 (diff)
Improve URL extraction
Diffstat (limited to 'youtube_dl/extractor/zdf.py')
-rw-r--r--youtube_dl/extractor/zdf.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/youtube_dl/extractor/zdf.py b/youtube_dl/extractor/zdf.py
index bb9020c91..afa3f6c47 100644
--- a/youtube_dl/extractor/zdf.py
+++ b/youtube_dl/extractor/zdf.py
@@ -15,6 +15,7 @@ from ..utils import (
try_get,
unified_timestamp,
update_url_query,
+ url_or_none,
urljoin,
)
@@ -67,8 +68,8 @@ class ZDFIE(ZDFBaseIE):
def _extract_subtitles(src):
subtitles = {}
for caption in try_get(src, lambda x: x['captions'], list) or []:
- subtitle_url = caption.get('uri')
- if subtitle_url and isinstance(subtitle_url, compat_str):
+ subtitle_url = url_or_none(caption.get('uri'))
+ if subtitle_url:
lang = caption.get('language', 'deu')
subtitles.setdefault(lang, []).append({
'url': subtitle_url,
@@ -76,8 +77,8 @@ class ZDFIE(ZDFBaseIE):
return subtitles
def _extract_format(self, video_id, formats, format_urls, meta):
- format_url = meta.get('url')
- if not format_url or not isinstance(format_url, compat_str):
+ format_url = url_or_none(meta.get('url'))
+ if not format_url:
return
if format_url in format_urls:
return
@@ -152,7 +153,8 @@ class ZDFIE(ZDFBaseIE):
content, lambda x: x['teaserImageRef']['layouts'], dict)
if layouts:
for layout_key, layout_url in layouts.items():
- if not isinstance(layout_url, compat_str):
+ layout_url = url_or_none(layout_url)
+ if not layout_url:
continue
thumbnail = {
'url': layout_url,