gpt4 book ai didi

facebook-graph-api - 我如何才能分别获得Facebook Graph API react 摘要计数

转载 作者:行者123 更新时间:2023-12-04 13:13:08 25 4
gpt4 key购买 nike

我如何才能分别获得Facebook Graph api react 摘要计数,
当我在Graph Explorer中尝试时,
例如:614689638666135_785960901539007/?fields=reactions.summary(true)我得到了总数和viewer_reaction,但还不够,请有人帮忙吗?

最佳答案

您需要明确要求每个 react ,但是,如注释中所述,您可以利用字段别名。

>>> fb_get_url = 'https://graph.facebook.com/v2.6/%s' % result['id']
>>> query_pieces ['reactions.type(LIKE).limit(0).summary(true).as(like)','reactions.type(LOVE).limit(0).summary(true).as(love)','reactions.type(WOW).limit(0).summary(true).as(wow)','reactions.type(HAHA).limit(0).summary(true).as(haha)','reactions.type(SAD).limit(0).summary(true).as(sad)','reactions.type(ANGRY).limit(0).summary(true).as(angry)', 'reactions.type(THANKFUL).limit(0).summary(true).as(thankful)']
>>> full_query = ",".join(query_pieces)
>>> r = requests.request("GET", fb_get_url, params={'access_token' : my_creds['access_token'], 'fields' : full_query})
>>> print(dumps(r.json(), indent=2))
{
"love": {
"data": [],
"summary": {
"total_count": 0,
"viewer_reaction": "LIKE"
}
},
"like": {
"data": [],
"summary": {
"total_count": 1,
"viewer_reaction": "LIKE"
}
},
"wow": {
"data": [],
"summary": {
"total_count": 1,
"viewer_reaction": "LIKE"
}
},
"haha": {
"data": [],
"summary": {
"total_count": 0,
"viewer_reaction": "LIKE"
}
},
"sad": {
"data": [],
"summary": {
"total_count": 0,
"viewer_reaction": "LIKE"
}
},
"thankful": {
"data": [],
"summary": {
"total_count": 0,
"viewer_reaction": "LIKE"
}
},
"id": "10100996730306423_10101331756810623",
"angry": {
"data": [],
"summary": {
"total_count": 0,
"viewer_reaction": "LIKE"
}
}
}
>>>

关于facebook-graph-api - 我如何才能分别获得Facebook Graph API react 摘要计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36930414/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com