summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2019-01-20 13:31:41 +0100
committerRemita Amine <remitamine@gmail.com>2019-01-20 13:31:52 +0100
commit6945b9e78f38284eb4e440b7badea2fc60b66c2f (patch)
treed68a9f4ecf6194d0a62b99dc1db707667dcb8e43
parent29cfcb43da8ac60e6c2eddad095a41c800d4d95a (diff)
downloadyoutube-dl-6945b9e78f38284eb4e440b7badea2fc60b66c2f.tar.gz
youtube-dl-6945b9e78f38284eb4e440b7badea2fc60b66c2f.tar.xz
youtube-dl-6945b9e78f38284eb4e440b7badea2fc60b66c2f.zip
[extractor/common] improve jwplayer relative url handling(closes #18892)
-rw-r--r--youtube_dl/extractor/common.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 6e36e6778..95456b291 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -2630,7 +2630,7 @@ class InfoExtractor(object):
                 'id': this_video_id,
                 'title': unescapeHTML(video_data['title'] if require_title else video_data.get('title')),
                 'description': video_data.get('description'),
-                'thumbnail': self._proto_relative_url(video_data.get('image')),
+                'thumbnail': urljoin(base_url, self._proto_relative_url(video_data.get('image'))),
                 'timestamp': int_or_none(video_data.get('pubdate')),
                 'duration': float_or_none(jwplayer_data.get('duration') or video_data.get('duration')),
                 'subtitles': subtitles,
@@ -2657,12 +2657,9 @@ class InfoExtractor(object):
         for source in jwplayer_sources_data:
             if not isinstance(source, dict):
                 continue
-            source_url = self._proto_relative_url(source.get('file'))
-            if not source_url:
-                continue
-            if base_url:
-                source_url = compat_urlparse.urljoin(base_url, source_url)
-            if source_url in urls:
+            source_url = urljoin(
+                base_url, self._proto_relative_url(source.get('file')))
+            if not source_url or source_url in urls:
                 continue
             urls.append(source_url)
             source_type = source.get('type') or ''