Facebook LIKE button shows larger amount of likes, than API!!!
I have a link: http://premija.intensa.pro/person/130/ilona_kvelde
When I create Like button on my page, it shows 48 likes at this moment (You can try to enter link in Get Code page: http://developers.facebook.com/docs/reference/plugins/like/)
But, when I execute FQL query, it shows less.
You can try in FQL Explorer
SELECT share_count, like_count, comment_count, total_count
FROM link_stat WHERE url='http://premija.intensa.pro/person/130/ilona_kvelde'
From running this in the explorer:
{
"data": [
{
"share_count": 2,
"like_count": 30,
"comment_count": 0,
"total_count": 32
}
]
}
You're right, there's a difference. There's probably some sort of time-delay, or privacy stuff, not sure. Notice that there's also a difference for running 'http://www.google.com'. But nevertheless if this is an important difference for you then you should file a bug here. Seems to be on a macro-level and thus by design, but its worth a shot.
Related
I am able to get share count and comments count but unable to get the likes count.
https://graph.facebook.com/?ids=MY_URL this API gives the response as,
{
"MY_URL": {
"share": {
"comment_count": 0,
"share_count": 13,
},
"id": "MY_URL",
}
}
In the same way, I just need to get likes count/ reaction count from API. Please help. Thanks in Advance
Check out the engagement field - https://developers.facebook.com/docs/graph-api/reference/v3.2/url
It returns four different counters - comment_count, comment_plugin_count, reaction_count and share_count.
The reaction_count would be the number of all reactions (like, love, sad, …) - that is as much “detail” as you can get in this regard for external Open Graph objects.
Example in Graph API Explorer, for the object http://example.com/:
https://developers.facebook.com/tools/explorer?method=GET&path=%3Fids%3Dhttp%253A%252F%252Fexample.com%252F%26fields%3Dengagement&version=v3.2
Prior to today, I used the following URL to get the Facebook share/like/comment count of a URL:
https://api.facebook.com/method/links.getStats?format=json&urls=http://stackoverflow.com/
Today, Facebook removed this feature. So now I'm using this:
https://graph.facebook.com/v2.7?emc=rss&fields=og_object{engagement},share&access_token=<ACCESS_TOKEN_GOES_HERE>&id=http://stackoverflow.com/
Which outputs:
{
"og_object": {
"engagement": {
"count": 45267,
"social_sentence": "45K people like this."
},
"id": "10150180465825637"
},
"share": {
"comment_count": 12,
"share_count": 45267
},
"id": "http://stackoverflow.com/"
}
The problem is, share_count is the total of likes + comments + shares (as far as I know).
Is there a way to get the number of likes, comments, and shares separately?
Looks like a bug in fb-api.
My solution:
receive the number of shares/comments as you describe in your question with
graph.facebook.com/?fields=og_object{id},share&id=https://stackoverflow.com/
save shares/comments count
save fb object-id of url
og_object->id
get likes count with (max limit is 1000, then you can use paging):
graph.facebook.com/OBJECT_ID/likes?access_token=ACCESS_TOKEN&pretty=1&limit=1000
UPD 2016-08-22
I found a solution that allows you to get the number of likes/reposts/comments in one step:
https://graph.facebook.com/?fields=og_object{likes.limit(0).summary(true)},share&ids=http://google.com,http://twitter.com
It is not currently possible.
Facebook is adding likes/shares/comments for URLs and returning them as shared_count.
Not possible to return correct number of individual likes/shares/comments, and that is not clear in the Graph API documentation. Not clear if it is a bug or a documentation error.
The old Rest API that provided this data was turned off on the 18th August.
There is a comment from a Facebook engineer explaining this in reply to a bug report, in the answer to this Stack Overflow question:
Getting Facebook Share, Like and Comment Counts for a Given URL with API Graph v2.6
You can also subscribe to this bug report at Facebook, but is a bit old with still no solution:
https://developers.facebook.com/bugs/748651458568287/
Given a particular URL, how can I get the Facebook Share count for it?
There is one way to get the count, i know that platforms like sharedcount.com are using this:
https://api.facebook.com/method/links.getStats?urls={your-url}/&format=json
I highly suggest not using FQL anymore, it is deprecated and no longer available in v2.1+ of the Graph API: https://developers.facebook.com/docs/apps/changelog#v2_1_deprecations
Edit: This is deprecated, but there is another possibility: Get FB likes, shares and comments for a URL using PHP - with no limit
The easiest way to do this is to fire off a request to the Graph API.
The following query will select:
like_count
total_count
share_count
click_count
comment_count
https://graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%27http://imdb.com%27
{
"data": [
{
"like_count": 62024,
"total_count": 191031,
"share_count": 93544,
"click_count": 71308,
"comment_count": 35463
}
]
}
Just replace the google.com with whatever URL you want to get the information for.
Often it seems fql number for a given url like, share, comment, total counts seem to be off.
For example this url
http://www.france24.com/en/20140112-reporters-crimean-tatars-unending-exile-identity-ethnic-minority-muslims-central-asia-ukraine
FQL shows:
share_count: 18377
like_count: 16215
comment_count: 8840
total_count: 43432
The graph api shows very different numbers, and if you check facebook widget count on the url itself it has a totally different count.
Anyone knows what is going on and how to get accurate numbers.
When querying link_stat with url you supplied we see the following:
select comment_count, like_count, share_count, total_count
from link_stat where url = 'http://www.france24.com/en/20140112-reporters-crimean-tatars-unending-exile-identity-ethnic-minority-muslims-central-asia-ukraine/'
{
"data": [
{
"comment_count": 10,
"like_count": 55,
"share_count": 18,
"total_count": 83
}
]
}
But when querying link_stat with parent url of site france24.com we see exactly your numbers (weel slightly changed of course, but almost the same). So check you query - maybe you cut the url somehow in you request?
select comment_count, like_count, share_count, total_count
from link_stat where url = 'http://www.france24.com/'
{
"data": [
{
"comment_count": 8840,
"like_count": 16415,
"share_count": 18377,
"total_count": 43632
}
]
}
Perhaps my initial question was not clear, the issue was with 2 forms of the same url returning radically different results in fql, web facebook widget etc. the urls in question are
http://www.france24.com/en/20140112-reporters-crimean-tatars-unending-exile-identity-ethnic-minority-muslims-central-asia-ukraine
and
http://www.france24.com/en/20140112-reporters-crimean-tatars-unending-exile-identity-ethnic-minority-muslims-central-asia-ukraine/
The URLs are identical except the ending /
The facebook sees the url as a string. Is case sensitive and it matters how you pass it for url. So, for facebook, there are really two different urls :/ The same happens if someone writes Ukraine with "U".
http://www.france24.com/en/20140112-reporters-crimean-tatars-unending-exile-identity-ethnic-minority-muslims-central-asia-Ukraine
I am trying to learn how to use the Facebook Open Graph API and have a question on how to determine the object_id of my site. I need this object_id so that I can do other queries, such as I want to get a list of users who have liked my site within a given time period.
Based on other Stackoverflow questions I have seen that I should be able to run this query to get the object_id
select id from object_url where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')
When I run that query it comes back with an empty result. When I run the following query, I see that my page has been liked 21 times
select total_count from link_stat where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')
What am I missing here? Any help will be greatly appreciated.
Thanks!
Most likely the url should be identical to the og:url meta tag if used on your website. Also you need to append the http:// part for it to work. For example this would work:
SELECT url,site,id
FROM object_url
WHERE url IN (
'http://developers.facebook.com',
'http://www.imdb.com/'
)
Result:
[
{
"url": "http://developers.facebook.com",
"site": "developers.facebook.com",
"id": 113167538713703
},
{
"url": "http://www.imdb.com/",
"site": "www.imdb.com",
"id": 6903354771
}
]
But this doesn't:
SELECT url,site,id
FROM object_url
WHERE url IN (
'developers.facebook.com',
'www.imdb.com/'
)