使用来自 Facebook Graph API Explorer ( https://developers.facebook.com/tools/explorer ) 的访问 token ,访问范围包括用户喜欢,我使用以下代码尝试获取用户个人资料的所有喜欢:
myfbgraph = facebook.GraphAPI(token)
mylikes = myfbgraph.get_connections(id="me", connection_name="likes")['data']
for like in mylikes:
print like['name'], like['category']
...
然而,这总是只给我 25 个赞,而我知道我使用的个人资料有 42 个赞。这里是否存在一些固有的限制,或者获取用户配置文件的所有页面喜欢的问题是什么?
请您参考如下方法:
根据图表文档:
When you make an API request to a node or edge, you will usually not receive all of the results of that request in a single response. This is because some responses could contain thousands and thousands of objects, and so most responses are paginated by default.
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging
