From 6887f872085891b139e022234ab17473d6bfb2d8 Mon Sep 17 00:00:00 2001 From: scrat5h <118751590+scrat5h@users.noreply.github.com> Date: Mon, 21 Nov 2022 15:38:09 +0000 Subject: [PATCH] [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. --- yt_dlp/extractor/pornhub.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py index e228ec6b1..620ca85f6 100644 --- a/yt_dlp/extractor/pornhub.py +++ b/yt_dlp/extractor/pornhub.py @@ -11,6 +11,7 @@ from ..compat import compat_HTTPError, compat_str from ..utils import ( NO_DEFAULT, ExtractorError, + base_url, clean_html, determine_ext, format_field, @@ -23,6 +24,7 @@ from ..utils import ( update_url_query, url_or_none, urlencode_postdata, + urljoin, ) @@ -325,10 +327,10 @@ class PornHubIE(PornHubBaseIE): r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'), video_id) if flashvars: - subtitle_url = url_or_none(flashvars.get('closedCaptionsFile')) + subtitle_url = flashvars.get('closedCaptionsFile') if subtitle_url: subtitles.setdefault('en', []).append({ - 'url': subtitle_url, + 'url': urljoin(base_url(url), subtitle_url), 'ext': 'srt', }) thumbnail = flashvars.get('image_url')