问题
Is it possible to search Facebook all public posts only for posts with links using the Graph API or FQL?
I tried a bit with https://graph.facebook.com/search?q=watermelon&type=post but couldn't figure it out...
回答1:
This query comes close:
https://graph.facebook.com/search?q=http:&type=post&fields=link
the "q" param says "only return posts whose message contains the string 'http:'", which gives a good first cut, but still lets some through without real links. You can then walk through the response and throw away any results that don't contain a 'link' field. If all you care about is the link itself, then "fields=link" says "only return the id, created_at, and link fields," and makes the query go a bit faster.
Looking it over, it appears that certain URLs do not turn into links -- e.g. bit.ly URLs. So maybe you want to get the message and parse it yourself, e.g.
https://graph.facebook.com/search?q=http:&type=post&fields=link,message
You may also want to do a search on 'https:' to get those URLs as well.
来源:https://stackoverflow.com/questions/5290961/searching-facebook-all-public-posts-only-for-posts-with-links-using-graph-api-or