Im trying to read the facebook posts from our wall and we decided we dont want all of the posts, we just want some of them. So basicly our idea was to add a special keyword (for example: "#keyword") to each post, and then simply search for all posts that contains the keyword. I dont know if theres a smarter solution, if there is any let me know :)
What i used before:
https://graph.facebook.com/<OurID>/posts?limit=15&access_token=<privateToken>
Now i found a way to get that what i want, but its using the FQL:
SELECT message
FROM stream
WHERE source_id = <ourID>
AND strpos(lower(message), "#keyword") >= 0;
I heard that the FQL is going to be removed soon. So is there a way to convert this FQL into the Facebook graph API?
As solution i just gather all the data and filter them by myself via CRON-Job.
Related
In order to get a list of likes I need to provide an object-id. If I provide my profile I will only get a list of the pages I liked. I currently
Graph = facebook.GraphAPI(access_token=token, version="3.0")
profile = graph.get_object('me')
posts = graph.get_connections("me", "likes")
print(len(posts['data']))
This currently returns 1, which is correct because I just like 1 page.
But I would like to get a list of all the thousands of likes I placed in specific posts, photos, videos, etc.
I would also like to get a list of all the Events which I didn't create but was invited to.
I can't seem to find a way to do these things. I've gone through the whole roll of possible things I can gather from my profile and none seems to return what I want. The most promising one was "objects" but I can't seem to get anything out of it.
Please help.
Thanks in advance,
Nuno
Im trying to get Facebook comments using the Graph Api.
I've researched online and found an example that works but there's one thing that about it that I can't find any information about it.
Here's the Example that works:
https://graph.facebook.com/19292868552_118464504835613/comments?access_token=ZZZZZZZ
https://graph.facebook.com/XXXXXXXXXXX_YYYYYYYYYYYYYYY/comments?access_token=ZZZZZZZ
How do I get XXXXXXXXXXX_YYYYYYYYYYYYYYY ?
Is it the UserId concatenated with the Comment Id, is it returned by the Graph Api?
Why is there practicaly no information on this?
In the case of getting a page's post_id you can make a call like this to get the post_id.
https://graph.facebook.com/v3.2/{pageId}/posts?access_token={accessToken}
post_id looks something like this - 5704324444475_570454233326 and is in the id field of each returned post.
To get all comments for a page first you need to make a call to get all your posts and then make a call for each post to get comments.
I'm having good luck using python and the FB graph api to collect reactions, comments from Facebook posts however, I'm having trouble targeting this specific photo link:
https://www.facebook.com/SheShopped/photos/a.432191143458704.110954.428340903843728/1367643623246780/?type=3&theater
Can anyone tell me how to deconstruct this link into a FB graph query?
If you want to look at the comments of this specific photo you just need to extract the id from the link (it's the last segment of the url) which is 1367643623246780. You'll find the comments at 1367643623246780/comments:
If you want to find this picture and others like it, you need to notice the type of picture (it is a 'Timeline Photo'). Looking at the relevant API-Documentation (Open Graph Page Photos) these can be found at 'SheShopped/photos/uploaded':
Could someone do me a flavour and let me know if you also get back an empty json array when you click on the sample user search url on the Facebook Graph Api docs page.
Here is the page http://developers.facebook.com/docs/reference/api/
It is in the search section. the people link.
Here is the link I am clicking and all other search links return data except the user search.
This is what I get back
My question is do other people have this problem as well or is it just me.
My suspicion is that it has to do with the way Facebook filters by privacy after they've selected your results. Meaning graph asks for (X) results, Facebook finds (X) results that match your search, then removes those who have it in their privacy options not me be searched, and then after filtering returns what's left. This is explained on Facebook's dev blog: https://developers.facebook.com/blog/post/478/
See the following answer for clearer details: https://stackoverflow.com/a/11848002/624590
That said, it could be something else - I've noticed it's been getting especially bad in recent weeks; fewer and fewer results seem to be returned.
We've been getting empty results for type=post for periods of 1-2 hours for the past few days. I'm sure it's related to something on their end, check out my bug post here http://developers.facebook.com/bugs/456910301017301?browse=search_509b0461dc68c0151458645
Is there anyway to determine if an object in Open Graph has been liked?
The documentation seem to imply that I have to post a like action on my object and expect an Error 3501 when it has been liked before.
From an UI pov this doesn't make sense, I want to change my like button ui to an "unlike" state without having to like my object and see if it fails or not.
Thanks!
If you're looking specifically for likes on an Open Graph Object (as in the target of an Open Graph Action), and you're talking about built-in (og.likes) likes, Shawn's answer is mostly right, but you need to look in a different FQL table.
An Open Graph Object is just a URL that resolves to a page that has og:type meta in its header. Facebook treats these as link objects (you can check this with SELECT type FROM object_url where url='http://url.to/your/object')
You can find interesting information in the link and link_stat FQL tables, but what you're looking for is the join table where Facebook relates user likes to links: the url_likes table.
So, to tell if the current user has liked a given Open Graph Object, you'd use:
SELECT user_id FROM url_like WHERE user_id=me() AND url='http://url.to/your/object'
If you get a value back, the current user has already liked it. If you get an empty array, the current user has not liked it.
To my knowledge, there's no way to do this with the Graph API, only FQL. I'd love to be proven wrong, though.
Depending on the object, if the object has a like connection you can user the graph api to determain if current user has liked the object.
i use fql in a similar fasion to check if a user likes a post.
/fql?q=SELECT+user_id+FROM+like+WHERE+post_id=\''.$postid.'\'+AND+user_id=me()
refer to post / like https://developers.facebook.com/docs/reference/api/page/