From 2a7e048a60b76a245deeea734885bdce5e6571ae Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:48:11 -0600 Subject: [PATCH] [ie/facebook] Remove broken login support (#15434) Authored by: bashonly --- yt_dlp/extractor/facebook.py | 64 ------------------------------------ 1 file changed, 64 deletions(-) diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py index 2c35013faa..99f64272b2 100644 --- a/yt_dlp/extractor/facebook.py +++ b/yt_dlp/extractor/facebook.py @@ -4,8 +4,6 @@ import urllib.parse from .common import InfoExtractor from ..compat import compat_etree_fromstring -from ..networking import Request -from ..networking.exceptions import network_exceptions from ..utils import ( ExtractorError, clean_html, @@ -64,9 +62,6 @@ class FacebookIE(InfoExtractor): class=(?P[\'"])[^\'"]*\bfb-(?:video|post)\b[^\'"]*(?P=q1)[^>]+ data-href=(?P[\'"])(?P(?:https?:)?//(?:www\.)?facebook.com/.+?)(?P=q2)''', ] - _LOGIN_URL = 'https://www.facebook.com/login.php?next=http%3A%2F%2Ffacebook.com%2Fhome.php&login_attempt=1' - _CHECKPOINT_URL = 'https://www.facebook.com/checkpoint/?next=http%3A%2F%2Ffacebook.com%2Fhome.php&_fb_noscript=1' - _NETRC_MACHINE = 'facebook' IE_NAME = 'facebook' _VIDEO_PAGE_TEMPLATE = 'https://www.facebook.com/video/video.php?v=%s' @@ -469,65 +464,6 @@ class FacebookIE(InfoExtractor): 'graphURI': '/api/graphql/', } - def _perform_login(self, username, password): - login_page_req = Request(self._LOGIN_URL) - self._set_cookie('facebook.com', 'locale', 'en_US') - login_page = self._download_webpage(login_page_req, None, - note='Downloading login page', - errnote='Unable to download login page') - lsd = self._search_regex( - r'', login_results) is not None: - error = self._html_search_regex( - r'(?s)]+class=(["\']).*?login_error_box.*?\1[^>]*>]*>.*?]*>(?P.+?)', - login_results, 'login error', default=None, group='error') - if error: - raise ExtractorError(f'Unable to login: {error}', expected=True) - self.report_warning('unable to log in: bad username/password, or exceeded login rate limit (~3/min). Check credentials or wait.') - return - - fb_dtsg = self._search_regex( - r'name="fb_dtsg" value="(.+?)"', login_results, 'fb_dtsg', default=None) - h = self._search_regex( - r'name="h"\s+(?:\w+="[^"]+"\s+)*?value="([^"]+)"', login_results, 'h', default=None) - - if not fb_dtsg or not h: - return - - check_form = { - 'fb_dtsg': fb_dtsg, - 'h': h, - 'name_action_selected': 'dont_save', - } - check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form)) - check_req.headers['Content-Type'] = 'application/x-www-form-urlencoded' - check_response = self._download_webpage(check_req, None, - note='Confirming login') - if re.search(r'id="checkpointSubmitButton"', check_response) is not None: - self.report_warning('Unable to confirm login, you have to login in your browser and authorize the login.') - except network_exceptions as err: - self.report_warning(f'unable to log in: {err}') - return - def _extract_from_url(self, url, video_id): webpage = self._download_webpage( url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id)