[facebook] raise AuthRequired for profiles requiring cookies (#7962)

This commit is contained in:
Mike Fährmann
2025-08-06 09:05:03 +02:00
parent 253d498a4e
commit b7a87fe2bb
2 changed files with 13 additions and 0 deletions

View File

@@ -315,6 +315,11 @@ class FacebookExtractor(Extractor):
for _ in range(self.fallback_retries + 1):
profile_photos_page = self.request(profile_photos_url).text
if ('"props":{"title":"This content isn\'t available right now"' in
profile_photos_page):
raise exception.AuthRequired("cookies")
set_id = self._extract_profile_set_id(profile_photos_page)
avatar_page_url = text.extr(
profile_photos_page, ',"profilePhoto":{"url":"', '"')

View File

@@ -5,6 +5,7 @@
# published by the Free Software Foundation.
from gallery_dl.extractor import facebook
from gallery_dl import exception
import datetime
@@ -65,6 +66,13 @@ __tests__ = (
"#count" : 0,
},
{
"#url" : "https://www.facebook.com/Forgetmen0w/photos",
"#comment" : "'This content isn't available right now'",
"#class" : facebook.FacebookPhotosExtractor,
"#exception": exception.AuthRequired,
},
{
"#url" : "https://www.facebook.com/facebook/avatar",
"#class" : facebook.FacebookAvatarExtractor,