[facebook] add fallback to 'biography' extraction (#8233)
This commit is contained in:
@@ -369,8 +369,12 @@ class FacebookExtractor(Extractor):
|
|||||||
for edge in (user["profile_tabs"]["profile_user"]
|
for edge in (user["profile_tabs"]["profile_user"]
|
||||||
["timeline_nav_app_sections"]["edges"])
|
["timeline_nav_app_sections"]["edges"])
|
||||||
]
|
]
|
||||||
user["biography"] = self.decode_all(text.extr(
|
|
||||||
page, '"best_description":{"text":"', '"'))
|
if bio := text.extr(page, '"best_description":{"text":"', '"'):
|
||||||
|
user["biography"] = self.decode_all(bio)
|
||||||
|
else:
|
||||||
|
user["biography"] = text.unescape(text.remove_html(text.extr(
|
||||||
|
page, ">Intro</span></span></h2>", "<ul>")))
|
||||||
except Exception:
|
except Exception:
|
||||||
if user is None:
|
if user is None:
|
||||||
self.log.debug("Failed to extract user data: %s", data)
|
self.log.debug("Failed to extract user data: %s", data)
|
||||||
|
|||||||
@@ -385,4 +385,14 @@ __tests__ = (
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://www.facebook.com/Forgetmen0w/info",
|
||||||
|
"#comment" : "'biography' fallback (#8233)",
|
||||||
|
"#class" : facebook.FacebookInfoExtractor,
|
||||||
|
"#auth" : True,
|
||||||
|
"#metadata": "post",
|
||||||
|
|
||||||
|
"biography": "G ❤️",
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user