Searching Facebook all public posts only for posts with links using Graph API or FQL?

萝らか妹 提交于 2020-01-06 11:46:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!