facebook-scraper icon indicating copy to clipboard operation
facebook-scraper copied to clipboard

number of posts stuck at 20

Open lgallais opened this issue 3 years ago • 2 comments

Hello

I tried to scrap a group facebook. It is this groupid : https://www.facebook.com/groups/353587895099778/. It is a public group.

there is my code

for post in get_posts(groups/353587895099778/, pages = 10, cookies='facebook_cookies.txt', options={"posts_per_page":200, "allow_extra_requests": True, "progress":True}): listpost.append(post) listlike.append(post['likes']) listcomments.append(post['comments'])

I can't get more than 22 posts back, no matter how much I change the settings.

Who has an idea?

lgallais avatar Feb 22 '22 17:02 lgallais

Same issue here. 20 posts seems to be the default number of posts shown then when you get to the bottom it asks to "See More Posts..." which I don't believe it used to.

Filch-Project avatar Feb 28 '22 14:02 Filch-Project

You need to tell the scraper you want to scrape a group, by passing the group ID with the group parameter. Also, posts_per_page has no effect for Groups, that only works for Pages. Like so:

posts = list(get_posts(group=353587895099778, pages = 10, options={"allow_extra_requests": False}))
print(len(posts))

This outputs 210 for me

neon-ninja avatar Mar 29 '22 21:03 neon-ninja