【发布时间】:2016-02-12 05:41:09
【问题描述】:
我正在下载公共页面的所有帖子。例如,Facebook 中“Google 页面”的最新帖子如下所示:
{
"created_time": "2016-02-04T02:55:11+0000",
"message": "We hope you\u2019re just as excited about the Year of the Monkey as we are! So excited, we\u2019ve been hunting around Street View for monkey sightings. Here are a few we found so far...want to help us find more 'Monkeys of StreetView'? #monkeyview goo.gl/8LhqMe",
"story": "Google added 4 new photos to the album: Monkeys of StreetView.",
"id": "104958162837_10153902425172838"
}
此json对象是以下代码返回的帖子之一:(代码来自其他stack-overflow页面,但帖子链接有限制)
from facepy import GraphAPI
import json
page_id = "Google"
access_token = "AccessToken"
graph = GraphAPI(access_token)
data = graph.get(page_id + "/feed", page=False, retry=3, limit=100)
with open('content.json', 'w') as outfile:
json.dump(data, outfile, indent = 4)
这篇文章应该有更多的领域。例如,使用与这篇文章关联的 ID,我使用这个链接并查看还有其他字段。例如,这篇文章中有多张图片,'https://graph.facebook.com/v2.4/104958162837_10153902425172838?fields=picture&access_token=AccessToken' 将返回:
{ "图片": "https://scontent.xx.fbcdn.net/hphotos-xfa1/v/t1.0-0/s130x130/12654459_10153902425172838_781196554188881203_n.jpg?oh=eef2aa5a6297767d9bd924c1e3311afc&oe=576EC3CA", “id”:“104958162837_10153902425172838” }
同样,它还有其他未显示在代码结果中的字段。例如,它还应该显示对这篇文章的喜欢。 所以我有两个问题:
为什么结果没有显示所有字段,尽管这些字段存在并且可以通过查询该帖子的 id 找到
这篇文章有多张图片,但我们只得到其中一张图片,当我查询点赞和 cmets 的数量而不是返回帖子的点赞或 cmets 时,它会返回某张图片。
谢谢。
【问题讨论】: