diff --git a/facebook_scraper/extractors.py b/facebook_scraper/extractors.py index 0a85f38d..a2b4f243 100644 --- a/facebook_scraper/extractors.py +++ b/facebook_scraper/extractors.py @@ -671,9 +671,10 @@ def extract_reactors(self, response, reaction_lookup): if not reaction_type: logger.error(f"Don't know {emoji_class}") except AttributeError: - reaction_type = emoji_style_lookup[ - elem.find(f"div>i", first=True).attrs.get("style") - ] + emoji_style = elem.find(f"div>i[style]", first=True).attrs.get("style") + reaction_type = emoji_style_lookup.get(emoji_style) + if not reaction_type: + logger.error(f"Don't know {emoji_style}") yield { "name": elem.find("strong", first=True).text, "link": utils.urljoin(FB_BASE_URL, elem.find("a", first=True).attrs.get("href")), diff --git a/facebook_scraper/utils.py b/facebook_scraper/utils.py index 6ba60472..75b0ef7a 100644 --- a/facebook_scraper/utils.py +++ b/facebook_scraper/utils.py @@ -11,6 +11,7 @@ from requests.cookies import RequestsCookieJar from requests_html import DEFAULT_URL, Element, PyQuery import json +import traceback from . import exceptions import logging @@ -271,6 +272,7 @@ def safe_consume(generator, sleep=0): result.append(item) time.sleep(sleep) except Exception as e: + traceback.print_exc() logger.error(f"Exception when consuming {generator}: {type(e)}: {str(e)}") return result