kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.47k stars 635 forks source link

When extracting reactors from comments: Local variable referenced before assignment in extractors.py #708

Open Ianneee opened 2 years ago

Ianneee commented 2 years ago

Hello, in extractors.py line 666, the local variable emoji_style_lookup under except cause an error. This is what i receive from the log:

[...]
Exception when consuming <generator object PostExtractor.extract_reactors at 0x7fb66b8f1dd0>: <class 'UnboundLocalError'>: local variable 'emoji_style_lookup' referenced before assignment

I'm trying to extract comment reactors from this post: 4909142392441238.

neon-ninja commented 2 years ago

Duplicate of https://github.com/kevinzg/facebook-scraper/issues/692. Try https://github.com/kevinzg/facebook-scraper/commit/5539ec467223286d952c5af5c19d89a8cffedb17. With this commit, I get:

'comments_full': [{'comment_id': '4909339462421531',
                    'comment_image': 'https://scontent.xx.fbcdn.net/m1/v/t6/An_UvxJXg9tdnLU3Y5qjPi0200MLilhzPXUgxzGjQzUMaNcmjdZA6anyrngvkdub33NZzZhd51fpCAEzNHFhko5aKRFP5fS1w_lKwYrzcNLupv27.png?ccb=10-5&oh=00_AT_cDuGQGqy6gqS4T3xMB3HjRVPku8yUu0mXEx98VxEWJw&oe=6249FFB9&_nc_sid=55e238',
                    'comment_reaction_count': 3,
                    'comment_reactions': {'like': 2, 'wow': 1},
                    'comment_reactors': [{'link': 'https://facebook.com/profile.php?id=100009670724353&fref=pb',
                                          'name': 'Mosè Sorbo',
                                          'type': 'like'},
                                         {'link': 'https://facebook.com/1235436786a?fref=pb',
                                          'name': 'Ian Cini',
                                          'type': 'wow'},
                                         {'link': 'https://facebook.com/vandelli1?fref=pb',
                                          'name': 'Fabrizio Vandelli',
                                          'type': 'like'}],
                    'comment_text': 'Grande prof Zangrillo lei avrebbe dovuto '
                                    'guidare questa nave che purtroppo da due '
                                    'anni fa acqua da tutte le parti',