Closed wgicio closed 3 years ago
What version are you using?
facebook-scraper 0.2.26
Does the script still generate a CSV despite the error? If so, can you post its contents here?
The CSV writer function uses the first post to get the columns to use as headers, and images
is not always set. Adding images
to the make new post function should fix this problem.
I see - here's a PR for that https://github.com/kevinzg/facebook-scraper/pull/193/files
macca@macca:~/Documents$ facebook-scraper --filename 1523008504577896.csv --pages 15 1523008504577896 Traceback (most recent call last): File "/usr/local/bin/facebook-scraper", line 8, in
sys.exit(run())
File "/home/macca/.local/lib/python3.8/site-packages/facebook_scraper/main.py", line 45, in run
write_posts_to_csv(
File "/home/macca/.local/lib/python3.8/site-packages/facebook_scraper/init.py", line 165, in write_posts_to_csv
dict_writer.writerows(list_of_posts)
File "/usr/lib/python3.8/csv.py", line 157, in writerows
return self.writer.writerows(map(self._dict_to_list, rowdicts))
File "/usr/lib/python3.8/csv.py", line 149, in _dict_to_list
raise ValueError("dict contains fields not in fieldnames: "
ValueError: dict contains fields not in fieldnames: 'images'