我有一个可以表示为HTTP和HTTPS的网址(从技术上讲,它们是不同的网址,但似乎已达成共识,即他们“相同”#。
在此示例中,HTTP URL重定向到HTTP URL。在许多情况下会发生这种情况,但我以facebook.com
为例。
我的目标是获得http://facebook.com
或https://facebook.com
"的总评论和分享次数。
使用HTTP网址https://graph.facebook.com/v2.7/http://facebook.com?access_token=XXXX
进行查询可以提供:
{
og_object: {
id: "10151063484068358",
title: "Welcome to Facebook - Log In, Sign Up or Learn More",
type: "website",
updated_time: "2016-08-31T14:49:01+0000"
},
share: {
comment_count: 5252,
share_count: 115724962
},
id: "http://facebook.com"
}
使用HTTPS,https://graph.facebook.com/v2.7/https://facebook.com?access_token=XXXX
:
{
og_object: {
id: "10151063484068358",
title: "Welcome to Facebook - Log In, Sign Up or Learn More",
type: "website",
updated_time: "2016-08-31T14:49:41+0000"
},
share: {
comment_count: 1348,
share_count: 115725362
},
id: "https://facebook.com"
}
使用og_object.id
,如果我查询https://graph.facebook.com/v2.7/10151063484068358/likes?summary=true&access_token=XXXX
,我会得到:
{
summary: {
total_count: 5890439,
can_like: false,
has_liked: false
}
}
再次完全不同。
并使用engagement
字段
https://graph.facebook.com/v2.7/10151063484068358?fields=engagement&access_token=XXXX
{
engagement: {
count: 115740062,
social_sentence: "115M people like this."
},
id: "10151063484068358"
}
我得到115740062,其中一个不同的数字再次,但至少接近上述(缓存可能会在不同的时间表上更新)。
作为旁注,engagement
和likes
都声称代表喜欢,但在另一个例子中,他们不同意:
https://graph.facebook.com/v2.7/https://www.co-operativebank.co.uk/?access_token=XXXX
给出910赞:
{
og_object: {
id: "10150337668163877",
description: "The Co-operative Bank provides personal banking services including current accounts, credit cards, online and mobile banking, personal loans, savings and more",
title: "Personal banking | Online banking | Co-op Bank",
type: "website",
updated_time: "2016-08-31T14:07:30+0000"
},
share: {
comment_count: 0,
share_count: 910
},
id: "https://www.co-operativebank.co.uk/"
}
https://graph.facebook.com/v2.7/10150337668163877?fields=engagement&access_token=XXXX
给出了相同的910喜欢
{
engagement: {
count: 910,
social_sentence: "910 people like this."
},
id: "10150337668163877"
}
https://graph.facebook.com/v2.7/10150337668163877/likes?summary=true&access_token=XXXX
给予零赞。
{
data: [ ],
summary: {
total_count: 0,
can_like: false,
has_liked: false
}
}
我抓住了四个不同的数字,我只想要一个!
观察:
10151063484068358
,我认为这是由一个网址重定向到另一个网址引起的。我努力在这里找到一致的东西。
是否可以获得http://facebook.com
或https://facebook.com
的评论和分享总数的标题数字?
或者是否可以某种方式使用og_object.id
10151063484068358
获得总计数?