From 65737226ac126ff880bd33af04ed7e0c4c716d22 Mon Sep 17 00:00:00 2001 From: Ian Cini <75807395+Ianneee@users.noreply.github.com> Date: Mon, 3 Oct 2022 04:12:35 +0200 Subject: [PATCH] Add comment_reaction_count also when comment_reactors opt is False (#903) The information on the total reactions to the comment can be useful even without having all the reactors or distinct reactions. --- facebook_scraper/extractors.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/facebook_scraper/extractors.py b/facebook_scraper/extractors.py index 904d405f..bdea61e5 100644 --- a/facebook_scraper/extractors.py +++ b/facebook_scraper/extractors.py @@ -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,