[facebook] ensure numeric 'user_id' values (#7953)

handle 'pfbid…' IDs
This commit is contained in:
Mike Fährmann
2025-08-02 10:19:34 +02:00
parent 491d70f918
commit 1fbc341e60
2 changed files with 56 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ class FacebookExtractor(Extractor):
"user_id": text.extr(
set_page, '"owner":{"__typename":"User","id":"', '"'
),
"user_pfbid": "",
"title": self.decode_all(text.extr(
set_page, '"title":{"text":"', '"'
)),
@@ -74,6 +75,13 @@ class FacebookExtractor(Extractor):
)
}
if directory["user_id"].startswith("pfbid"):
directory["user_pfbid"] = directory["user_id"]
directory["user_id"] = (
text.extr(
set_page, '"actors":[{"__typename":"User","id":"', '"') or
directory["set_id"].split(".")[1])
return directory
def parse_photo_page(self, photo_page):
@@ -92,6 +100,7 @@ class FacebookExtractor(Extractor):
"user_id": text.extr(
photo_page, '"owner":{"__typename":"User","id":"', '"'
),
"user_pfbid": "",
"caption": self.decode_all(text.extr(
photo_page,
'"message":{"delight_ranges"',
@@ -115,6 +124,11 @@ class FacebookExtractor(Extractor):
)
}
if photo["user_id"].startswith("pfbid"):
photo["user_pfbid"] = photo["user_id"]
photo["user_id"] = text.extr(
photo_page, r'\"content_owner_id_new\":\"', r'\"')
text.nameext_from_url(photo["url"], photo)
photo["followups_ids"] = []