dfreelon / fb_scrape_public

Scrapes posts and comments from public Facebook pages.
BSD 3-Clause "New" or "Revised" License
106 stars 52 forks source link

403 when scraping posts from groups #8

Closed naught101 closed 6 years ago

naught101 commented 6 years ago

I'm trying to scrape old posts from a group I'm in, and everything I've tried fails with 403. As far as I can tell, I'm using the correct tokens. I've tried with clientID/clientSecret, and with access tokens (both for the app I created, and for my user. I've also tried with scrape_mode='posts' and with the default. The response always looks like this:

In [13]: posts = fsp.scrape_fb(token=YourAccessToken, ids="166298646868224", scrape_mode="posts")
HTTP Error 403: Forbidden
Skipping ID 166298646868224 ...
Script completed in 0.39893054962158203 seconds.

Any ideas? The barackobama example DOES work, so I guess this is something specific to groups, and possibly just to groups with a numeric ID?

dfreelon commented 6 years ago

It should work for public groups. The app method definitely won't scrape non-public groups, and if it doesn't work with a user token, it's possible the Graph API simply doesn't support those actions at all. I would try seeing if other Facebook scraping programs work, or maybe running your commands through the Graph Explorer: https://developers.facebook.com/tools/explorer/ At least then you'd know whether the problem is with my program or the API.

naught101 commented 6 years ago

Looks like my access token was wrong somehow... Working with a new one. Sorry for the hassle, and thanks for the quick response :)