Open jha46 opened 3 years ago
Hi,
Try pass cookies as per the readme. The reason being, that Facebook shows different counts of reactions depending on whether you're logged in or not - just likes if you're not, or actual total if you are. Similarly for the comment count, with count of top level comments vs count of comments + replies. Extracting reactions also likely require a login. The total count of reactions can be found in the reaction_count
key.
This sample code:
post = next(get_posts(post_urls=[4451740514910367], cookies="cookies.json", options={"comments": True, "reactions": True, "progress": True}))
count = 0
for comment in post["comments_full"]:
count += 1 + len(comment["replies"])
print(f'''Comments: {post["comments"]}
Likes: {post["likes"]}
Reactions: {post["reaction_count"]} ({post["reactions"]})
len(comments): {len(post["comments_full"])}
len(comments+replies): {count}''')
outputs:
Comments: 57
Likes: 392
Reactions: 459 ({'like': 392, 'love': 56, 'wow': 4, 'care': 6, 'sad': 1})
len(comments): 26
len(comments+replies): 51
It works. Thank you so much.
Hello. I faced several problems while using this package for scraping public pages.