facebook-page-post-scraper
facebook-page-post-scraper copied to clipboard
Unicode Encode Error on Public Group Scraping
Hello,
I received an Unicode Encode error on running the get_fb_posts_fb_group.py script. I am using Python 3.6.1 :: Anaconda 4.4.0 (64-bit). The .csv file was created and scraped around 19 posts. Full CSV file is available here: https://pastebin.com/BjZY8eEn . Do you know what Unicode characters might have caused this issue? I verified that the group is encoded in UTF-8. The character causing the error appears to be :
Unicode Character 'LATIN SMALL LETTER C WITH CARON' (U+010D)
C:\Users\Mike\Documents\Dad\Lynda.com Python\Machine Learning\facebook-page-post-scraper-master>python get_fb_posts_fb_group.py Scraping 266989076737353 Facebook Group: 2017-07-25 21:48:53.087302
Traceback (most recent call last):
File "get_fb_posts_fb_group.py", line 199, in
It seems to be a problem when writing into the .csv file.
Try to change the
with open('{}_facebook_statuses.csv'.format(group_id), 'w') as file:
line to
with open('{}_facebook_statuses.csv'.format(group_id), 'w', encoding='utf-8') as file:
For me it was U0001f44d
, or the "thumbs up" sign. @umutto's suggestion seemed to do the trick.
@umutto thanks worked for me