简体   繁体   中英

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

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...

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 -- eg bit.ly URLs. So maybe you want to get the message and parse it yourself, eg

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM