Finding who shared a link publicly and finding who

2019-07-04 00:48发布

问题:

Two questions regarding tracking shared links:

  1. I have a URL and I want to get a list of public shares for that URL. I found this was answered a couple of times here on stackoverflow claiming it's impossible, but I don't understand why this is not allowed. If I can query public posts for given search keywords, like: https://graph.facebook.com/search?q=watermelon&type=post, then why can't I use URLs as my search query? Or is there a way to do this that I just missed somehow?

  2. Let's say I have a link_id for a shared URL in the "link" FQL table. How can I find reshares of that link? (As possible in the Facebook website.)

As an attempt to find middle ground between the above 2 problems, I tried to perform this FQL query:

SELECT link_id, owner, title FROM link WHERE url="<url>" AND (
    owner = me() OR owner IN (SELECT uid2 FROM friend WHERE uid1 = me())
)

But this failed, with error:

<error_response xmlns="http://api.facebook.com/1.0/">
    <error_code>1</error_code>
    <error_msg>An unknown error occurred</error_msg>
</error_response>

回答1:

  1. I don't think that it is possible to search based on URL when doing an FQL query on the link table because the url column is not indexable. The indexable columns are marked with a star on the Facebook FQL link reference.

  2. Because the only indexable columns are link_id and owner_id, I do not think you can use FQL on this table to solve your problem. You could potentially load all available links into your application and then parse through them, but that API call can take a long time.

If you want to just search public posts, you could try putting the url directly into the query area of your public graph search. For example, if I wanted to search for references to www.google.com:

GET https://graph.facebook.com/search?q=www.google.com&type=post