mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[extractor/common] improve jwplayer relative url handling(closes #18892)
This commit is contained in:
parent
29cfcb43da
commit
6945b9e78f
@ -2630,7 +2630,7 @@ def _parse_jwplayer_data(self, jwplayer_data, video_id=None, require_title=True,
|
|||||||
'id': this_video_id,
|
'id': this_video_id,
|
||||||
'title': unescapeHTML(video_data['title'] if require_title else video_data.get('title')),
|
'title': unescapeHTML(video_data['title'] if require_title else video_data.get('title')),
|
||||||
'description': video_data.get('description'),
|
'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')),
|
'timestamp': int_or_none(video_data.get('pubdate')),
|
||||||
'duration': float_or_none(jwplayer_data.get('duration') or video_data.get('duration')),
|
'duration': float_or_none(jwplayer_data.get('duration') or video_data.get('duration')),
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
@ -2657,12 +2657,9 @@ def _parse_jwplayer_formats(self, jwplayer_sources_data, video_id=None,
|
|||||||
for source in jwplayer_sources_data:
|
for source in jwplayer_sources_data:
|
||||||
if not isinstance(source, dict):
|
if not isinstance(source, dict):
|
||||||
continue
|
continue
|
||||||
source_url = self._proto_relative_url(source.get('file'))
|
source_url = urljoin(
|
||||||
if not source_url:
|
base_url, self._proto_relative_url(source.get('file')))
|
||||||
continue
|
if not source_url or source_url in urls:
|
||||||
if base_url:
|
|
||||||
source_url = compat_urlparse.urljoin(base_url, source_url)
|
|
||||||
if source_url in urls:
|
|
||||||
continue
|
continue
|
||||||
urls.append(source_url)
|
urls.append(source_url)
|
||||||
source_type = source.get('type') or ''
|
source_type = source.get('type') or ''
|
||||||
|
Loading…
Reference in New Issue
Block a user