Open Ace2RA opened 2 years ago
See https://github.com/kevinzg/facebook-scraper/search?q=json.dump&type=issues for some examples using json.dump. https://github.com/kevinzg/facebook-scraper/search?q=to_csv&type=issues for some examples using pandas to_csv
@Ace2RA Here is the code I'm using to get live posts and save them to json file.
from facebook_scraper import *
import json
with open('yourfilename.json', 'w', encoding='utf8') as f:
posts = list(get_posts("facebook-page-group", pages=2, cookies="cookies.json",
options={"allow_extra_requests": False}))
json.dump(posts, f, ensure_ascii=False, default=str);
Hope this helps a bit.
Regarding to the code in #742, how do I export the pprint output to a json/ccv file?