[extractor/pornhub] URL to subtitles is relative

`closedCaptionsFile` field on the page is not absolute URL (anymore?)
but relative one.

This change makes extracting subtitles working again.
pull/5618/head
scrat5h 2 years ago
parent 1138e33ac5
commit 6887f87208

@ -11,6 +11,7 @@ from ..compat import compat_HTTPError, compat_str
from ..utils import ( from ..utils import (
NO_DEFAULT, NO_DEFAULT,
ExtractorError, ExtractorError,
base_url,
clean_html, clean_html,
determine_ext, determine_ext,
format_field, format_field,
@ -23,6 +24,7 @@ from ..utils import (
update_url_query, update_url_query,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,
urljoin,
) )
@ -325,10 +327,10 @@ class PornHubIE(PornHubBaseIE):
r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'), r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'),
video_id) video_id)
if flashvars: if flashvars:
subtitle_url = url_or_none(flashvars.get('closedCaptionsFile')) subtitle_url = flashvars.get('closedCaptionsFile')
if subtitle_url: if subtitle_url:
subtitles.setdefault('en', []).append({ subtitles.setdefault('en', []).append({
'url': subtitle_url, 'url': urljoin(base_url(url), subtitle_url),
'ext': 'srt', 'ext': 'srt',
}) })
thumbnail = flashvars.get('image_url') thumbnail = flashvars.get('image_url')

Loading…
Cancel
Save