Skip to content

Commit

Permalink
[extractor/common] improve jwplayer relative url handling(closes ytdl…
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Jan 20, 2019
1 parent 29cfcb4 commit 6945b9e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions youtube_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,7 @@ def _parse_jwplayer_data(self, jwplayer_data, video_id=None, require_title=True,
'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,
Expand All @@ -2657,12 +2657,9 @@ def _parse_jwplayer_formats(self, jwplayer_sources_data, video_id=None,
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 ''
Expand Down

0 comments on commit 6945b9e

Please sign in to comment.