From 7ea2787920cccc6b8ea30791993d114fbd564434 Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Mon, 18 Nov 2024 05:36:38 +0000 Subject: [PATCH] [ie/reddit] Improve error handling (#11573) Authored by: bashonly --- yt_dlp/extractor/reddit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yt_dlp/extractor/reddit.py b/yt_dlp/extractor/reddit.py index b633dc48af..7325e547b3 100644 --- a/yt_dlp/extractor/reddit.py +++ b/yt_dlp/extractor/reddit.py @@ -259,6 +259,8 @@ def _real_extract(self, url): f'https://www.reddit.com/{slug}/.json', video_id, expected_status=403) except ExtractorError as e: if isinstance(e.cause, json.JSONDecodeError): + if self._get_cookies('https://www.reddit.com/').get('reddit_session'): + raise ExtractorError('Your IP address is unable to access the Reddit API', expected=True) self.raise_login_required('Account authentication is required') raise