From 0a8b675da904c734c49e7022cc87c389d0ec0b2c Mon Sep 17 00:00:00 2001 From: ringus1 Date: Thu, 1 Feb 2024 09:56:34 +0100 Subject: [PATCH] Move getting cookies before making first request --- yt_dlp/extractor/facebook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py index b6366e78ce..0e39eddcb3 100644 --- a/yt_dlp/extractor/facebook.py +++ b/yt_dlp/extractor/facebook.py @@ -481,13 +481,14 @@ class FacebookIE(InfoExtractor): return def _extract_from_url(self, url, video_id): + cookies = self._get_cookies(url) # Saving before making first request, as they might get discarded + webpage = self._download_webpage( url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id) sjs_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall( r'data-sjs>({.*?ScheduledServerJS.*?})', webpage)] - cookies = self._get_cookies(url) if cookies.get('c_user') and cookies.get('xs'): # user passed logged-in cookies or attempted to login: if get_first(sjs_data, ( 'require', ..., ..., ..., '__bbox', 'define',