From 9ecbbcd844c0e26e7325004994add692fd381b05 Mon Sep 17 00:00:00 2001 From: scrat5h <118751590+scrat5h@users.noreply.github.com> Date: Tue, 22 Nov 2022 10:50:47 +0100 Subject: [PATCH] [extractor/pornhub] Remove fetch of /video/get_media for formats Previously URLs that contained `/video/get_media` returned JSON with available formats. Some time ago Pornhub seem to removed this endpoint and has started to return `HTTP Error 403: Forbidden`, see #4298. Nowadays it seem to serve originally requested html page which, of course, cannot be parsed with JSON parser. yt-dlp produced WARNING: ``` Failed to parse JSON: Expecting value in '': line 1 column 1 (char 0). ``` Since we are already getting format of the video by other means (`mpd` or `m3u8`) this change removes fetching of URLs that don't provide value to us anymore. Fixes: #5615 --- yt_dlp/extractor/pornhub.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py index 620ca85f60..5dcee86605 100644 --- a/yt_dlp/extractor/pornhub.py +++ b/yt_dlp/extractor/pornhub.py @@ -457,18 +457,6 @@ def add_format(format_url, height=None): r'/(\d{6}/\d{2})/', video_url, 'upload data', default=None) if upload_date: upload_date = upload_date.replace('/', '') - if '/video/get_media' in video_url: - medias = self._download_json(video_url, video_id, fatal=False) - if isinstance(medias, list): - for media in medias: - if not isinstance(media, dict): - continue - video_url = url_or_none(media.get('videoUrl')) - if not video_url: - continue - height = int_or_none(media.get('quality')) - add_format(video_url, height) - continue add_format(video_url) model_profile = self._search_json(