if isinstance(post, dict):
# Print post on the screen
print(post)
print(json.dumps(post, indent=2, default=str))
for x in post:
print(x, post[x])
# Print json object to file one object/post per line
with open('fb.json', 'a', encoding='utf-8') as f:
json.dump(post, f, ensure_ascii=False, default=str)
f.write("\n")
print(post.get('post_text', 'No post text available'))
for cmt in post.get('comments_full', []):
print(cmt.get('commenter_name', ''), " : ", cmt.get('comment_text', '').replace("\n", ""))
else:
print("Post is not a dictionary:", post)
listposts = [] MAX_COMMENTS=100
for post in get_posts("nintendo", pages=2):
posts = get_posts(post_urls=["https://www.facebook.com/britishairways","https://www.facebook.com/jemeeluAnna.Followers"],extra_info=True,credentials=('',''), options={"comments": MAX_COMMENTS, "progress": True})
for post in posts: