Skip to content

Commit

Permalink
Add comment_reaction_count also when comment_reactors opt is False (#903
Browse files Browse the repository at this point in the history
)

The information on the total reactions to the comment can be useful
even without having all the reactors or distinct reactions.
  • Loading branch information
Ianneee authored Oct 3, 2022
1 parent 5a48303 commit 6573722
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions facebook_scraper/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,13 @@ def parse_comment(self, comment):
reactions = self.extract_reactions(comment_id, force_parse_HTML=True)
if comment_reactors_opt != "generator":
reactions["reactors"] = utils.safe_consume(reactions.get("reactors", []))
else:
reactions_count = comment.find('span._14va', first=True)
if reactions_count and len(reactions_count.text) > 0:
reactions_count = reactions_count.text
else:
reactions_count = None
reactions.update({"reaction_count": reactions_count})

return {
"comment_id": comment_id,
Expand Down

0 comments on commit 6573722

Please sign in to comment.