How do I query links shared by Facebook Pages?

2019-08-21 23:33发布

问题:

I can get a user's page/likes list using the graph /me/likes. But how can I return a list of links shared by these Pages?

For example, let's say a user likes the Facebook Platform Page. I can pull this id (19292868552) using the /me/likes graph api. But how can I pull the links that the Facebook Platform Page has shared on their page?

For a regular user you would do something like this:

Sample FQL:

SELECT link_id, title, summary, url FROM link WHERE owner IN (19292868552);

But for Facebook Pages (like the above Facebook Platform Page example), this returns null. But the actual Facebook Platform Page shows dozens of links (at least). How can I get the links shared by these pages?

You can test it here: FQL Query Test Console

回答1:

I'm a little late to the party here, but I thought I'd post my gist example here. fbconsole makes it fairly simple to extract data through the Facebook Graph API to address this issue.

The caveat is that it was not terribly easy to programmatically extract data through fbconsole so I wrote the fbconsole.automatically_authenticate to make it much easier to access this information in a systematic way. This addition has not yet been incorporated into the master branch of fbconsole (it was just posted this morning), but it is available here in the meantime for those that are interested.