How to retrieve FB comments/shares for a specific URL - facebook

I would like to retrieve the text,author of comments or shares made for a specific url.
I have for instance the following target : http://www.graphemeride.com/blog/comment-j-ai-triche-aux-golden-blog-awards
I can retrieve the number of comments and shares with FQL :
SELECT
url, share_count , comment_count, comments_fbid
FROM
link_stat
WHERE
url="http://www.graphemeride.com/blog/comment-j-ai-triche-aux-golden-blog-awards"
I get the following result :
{
"data": [
{
"url": "http://www.graphemeride.com/blog/comment-j-ai-triche-aux-golden-blog-awards",
"share_count": 27,
"comment_count": 26,
"comments_fbid": 357167807708699
}
]
}
My plan was to use the comment FQL query to retrieve the different comments.
SELECT
id, text
FROM
comment
WHERE
object_id="357167807708699"
However I get an empty result dataset.
I added the required access token, but kind of understood that I can only get comments I made about this object, not public comments or shares.
Is there an alternative way to get access to what people publicly said about an url ?

The comment count on the link_stat table is the for the number of comments on the SHARES of this link and not the number of comments on the comments plugin on that page itself.
Whereas the comments table returns you the number of comments from the comments plugins on that page.
As your page isn't using any fb comments plugin, you don't get any comments back.

Related

Can we get the share count of a post in fb using graph api v2.3?

I need to get the shares count of a particular post in fb uisng graph api.
I could'nt find any method to do so. I have followed the link below.
https://developers.facebook.com/docs/graph-api/reference/v2.3/object/sharedposts
It returns the data of the shared posts in pagination format.
Is there any way to get the total count of the shares without fetching the whole data and without paginating within the data?
Please suggest!!
Just the field shares should give you the number of shares for a POST_ID
[POST_ID]?fields=shares
Sample data from my feed
{
"shares": {
"count": 1
},
"id": "POST_ID",
"created_time": "2015-04-29T09:07:12+0000"
}
Get shares count :
114916098537132_1265715836790480?fields=shares
Bonus [ Get likes + shares + comments ]
114916098537132_1265715836790480?fields=shares,likes.summary(true),comments.summary(true)
Improved version ( add limit(0) to removes list of likes and get only summary ):
114916098537132_1265715836790480?fields=shares,likes.limit(0).summary(true),comments.limit(0).summary(true)

Facebook FQL returns no result, while GraphAPI does

I'm trying to get Facebook user information by username. I'm trying to make following FQL request:
SELECT first_name, last_name FROM user WHERE username="Google"
I got no data in response:
{
"data": [
]
}
Same query works OK for other usernames:
SELECT first_name, last_name FROM user WHERE username="c1egger"
This gives me:
{
"data": [
{
"first_name": "Paul",
"last_name": "Dmitryev"
}
]
}
I've tried to use GrapAPI with following request:
/Google?fields=id,name
And got the result:
{
"name": "Google",
"id": "104958162837"
}
Also, I'm getting same problem, when trying to query by userid.
Major part of my application uses FQL, so I'd like to figure out why FQL not working, before starting complex porting to FQL.
They are not the same request...
/Google?fields=id,name
That request doesn't check in "User" table, that's why you can't retrieve user "google" with '104958162837' id.
facebook.com/c1egger and facebook.com/Google are not the same type of page.
select name from page where page_id=104958162837
or
select page_id from page where username='Google'
Gives you the same result as the graph api.
FQL works, but it's more complex that GraphApi to use.
Facebook Query Language, or FQL, enables you to use a SQL-style interface to query the data exposed by the Graph API. It provides advanced features not available in the Graph API.

How to get shares count for a Photo in Facebook?

I want to get comments count, likes count and shares count for a page posts. I have their IDs and I'm trying to figure something out with the Graph API or FQL, but in vain.
For regular posts I can query the stream FQL table and I get the comment_info, like_info structures and shares_count variable.
For posted photos I can query the photo table and I get from there comment_info and like_info, but it lacks the shares_count.
I tried using Graph api like that: GET /550045508388715 and it returns a ton of information, but nothing related to share count.
I've googled that issue, but did not found any relevant solution.
Instead of GET /ID use GET /POST_ID to get the shares count (if >1). You'll get the result as-
"shares": {
"count": x
}
Note- the Post ID is generally: USERID_PHOTOID ORPAGEID_PHOTOID

Retrieve posts and comments from Facebook wall with Open Graph/FQL

I am finding many difficults while trying to do a rather simple task using facebooks' api (FQL and Open graph).
The task is what the title says getting post-list and relative comments from a user wall i tried via FQL and open graph without results :
Approach 1) open graph
simple me/feed query returns almost what I want but it includes self-references results such as
{
"id": "1614018744_10200682419255581",
"from": {
"name": "Franco Martinelli",
"id": "1614018744"
},
"story": "\"UNO\" on his own status.",
"privacy": {
"value": ""
},
"type": "status",
"created_time": "2013-06-16T13:49:58+0000",
"updated_time": "2013-06-16T13:49:58+0000"
},
and i cant seem to find what to filter to exclude those records or if i am supposed to filter on my end
Approach 2) With this query in FQL
{"q1":"SELECT post_id, actor_id,target_id, message FROM stream
WHERE source_id=me()
AND type in (46,56,80,128,247) AND created_time < 1371254400 LIMIT 250",
"q2":"SELECT text from comment where post_id IN (SELECT post_id FROM #q1)"}
i get my own posts but not post made by others and also the limit clause works in mysterious way from what i have read around.
I have used twitter api's without a single problem,i cant believe i have to go through all this mess for a simple request.
Here are the two queries. You need to include type = 'newsfeed' then that would bring up posts made by your friends,just like your news feed on facebook.com
getpost: ("SELECT actor_id, created_time, likes, post_id, message FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0"),
users: ("SELECT id, name, url, pic FROM profile WHERE id IN (SELECT actor_id FROM #getpost)")
http://fbdevwiki.com/wiki/FQL:stream

Want to verify that recommend counts come through like_count in FQL queries. So, total_count returns all shares, likes and recommends?

Can someone please confirm that I can pull the number of users who have recommended a URL via the like_count in FQL queries? I want to confirm that total_count returns all shares, likes and recommends. Thanks in advance.
You can use:
https://graph.facebook.com/URL_ENCODED_LINK
At a minimum, it should return:
{
"id": LINK,
"shares": COUNT_SHARES
}
Example for facebook.stackoverflow.com: https://graph.facebook.com/http%3A%2F%2Ffacebook.stackoverflow.com
And result:
{
"id": "http://facebook.stackoverflow.com",
"shares": 668
}
Update: Just noticed you want to use FQL queries. If the above doesn't work for you I'll take a look in the FQL tables, there should be something AFAIK :)