I’m doing a research and I wanna create a dataset formed by Facebook posts. The problem is that I can’t retrieve public posts,
It seems like Facebook doesn’t allow to retrieve public data, so I don’t know how to do it.
If anybody knows how I can get public posts from public pages I’ll be thankful.
I tried with the Facebook Graph API but if I want to retrieve the posts of a page it asks me for the page-id which i don’t know where to get it. Also there’s seem to be a problem with the authorization once i make the requests.
2
Answers
Facebook surely allows public posts to be fetched. You said it yourself, all you need is the page ID. To get a page ID, Meta suggests you start here. In order to utilize that endpoint however, you will need a user ID. The user ID is present in the URL for any given user page.
Leverage URLSearchParams to grab the ID from the search bar, and then pass that ID to the Page endpoint query.
I recommend playing around with this tool that will generate code snippets via an interactive UI.
Facebook doesn’t allow just any arbitrary access to public data via API any more.
Your app would have to get the Page Public Content Access feature approved.
But the only allowed use case they list is "[to] provide competitive benchmark analysis", so whether they would approve it for your intended usage, you’d have to see.