def queryFB (page_id, since_inp, until_inp, access_token=access_token):
""" retrieve the statuses of one page for a specified time range"""
# format since = "YYYY-MM-DD"T"HH:MM:SS+XXXX" (XXXX = time zone difference)
# format until = "YYYY-MM-DD"T"HH:MM:SS"
# format access_token = [app_id] + "|" + [app_secret]
# build URL
base = "https://graph.facebook.com/v2.11"
node = "/"
since = "since=" + str(since_inp)
plus = "&"
until = "until=" + str(until_inp)
fields = "fields=id,created_time,updated_time,message,likes.summary(True)"
token = "access_token=%s" % access_token
url = base + node + page_id + node + "posts?" + since + plus + until + plus + fields + plus + token
print(url)
检查图形api的this endpoint:
/{user-id}/posts shows only the posts that were published by this person
。如果需要示例,请选中this answer(在python中实现)。
任何问题,请务必提出。
您可以使用Facebook Graph Api。 下面是一个从facebook的堆栈溢出页面获取所有帖子的示例(您需要访问令牌):
请求的结构是:
您可以使用Facebook Graph Explorer tool来测试和获取临时访问令牌。
要按日期检索FB页面的帖子,我使用以下函数:
(当然,这将需要修改以使用输出。)
相关问题 更多 >
编程相关推荐