Graph API's search returning considerately less public posts than Facebook's user facing search?

偶尔善良 提交于 2020-01-04 06:13:36

问题


I'm developing an application based on facebook's data using the Graph API. Part of the functionality entails searching Facebook's public post, essentially in the same fashion that Facebook does on www.facebook.com/search:

http://www.facebook.com/search/results.php?q=thanksgiving&type=eposts&init=quick&tas=0.31611707084812224

However, when I issue the same search via the Graph API, the results return miss many of the posts shown in the standard user interface. Many of the most recent posts returned by the standard search are missing (replace the access_token to the one you have):

https://graph.facebook.com/search?q=thanksgiving&type=post&access_token=XXXX

Does anyone have an idea what can cause this and how I can work around it? I have customer questioning the quality of my application because of this difference.

Many thanks, Boaz


回答1:


That is because the Graph API uses pagination if it returns too many objects, if you take a look on the bottom of the response of the "Nike" search you will find this:

"paging": {
      "previous": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&since=1322257702&__previous=1",
      "next": "https://graph.facebook.com/search?q=nike&type=post&access_token=XX&limit=25&until=1322246079"
   }

Just make another request to the "next" url in order to fetch more results.



来源:https://stackoverflow.com/questions/8274444/graph-apis-search-returning-considerately-less-public-posts-than-facebooks-use

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