How do I get a list of friends who clicked "Like" on an external page? - facebook

PART A -
There are many many questions like this, but none of them seem to provide a working solution. I want to get a list of friends who clicked the Facebook "Like" button on an external site.
NOTE: This is NOT for a Facebook page. In this case, I know I can query the page_fan table.
To get the list of Facebook page-likes for example, I can use the url_like table. I guess I just want a way to invert this table. I know I cannot get a list of ALL people that liked a link due to privacy concerns, but I want a list of my friends alone - which should be fine.
I know facebook does this internally every time I see a Facebook Like button... right below that there is statistics about my friends that also like the same link. How do I get this using FQL?
PART B
Equivalently, how do I get a list of friends that shared a specific URL as a link? I cannot search the link table by url because that is not indexed. Also, the link_id is not the same as the Open Graph ID of the URL.
I tried select link_id from link where url="http://urladdress.com/a/b.html" and owner in (select uid2 from friend where uid1=me()) but that neither throws an error not returns anything... just stalls.

Part A: you can't.
Part B: you can't the way you are trying. You might be able to get the feed for every one of the users friends and look for that url from their feed, but it will be painfully slow.
Lots of people would like to know this but Facebook is (rightfully so) not giving this information out. That is why you see lots of questions regarding it but no working solutions.

You could possibly look into the read_insights permission. You might not be able to get the exact information about "likes" (yet)... but you will be able to get other possibly useful information.

Related

facebook likes that WE have done

We have several people working on our Facebook page, and I am trying to find out if there is a way to list all the companies that WE have liked - not the ones that like us.
I know that isn't possible to do (apart from analytic data). We are a chamber of commerce, and we were liking all our members who are on Facebook, hoping to be able to look back and find out how many are actually on Facebook.
Hope this makes sense, and I hope it is possible. :)
Sure just go to: https://developers.facebook.com/tools/explorer (you must be a registered facebook developer to acces this tool).
Then on the input where you have this:
your_fb_id?fields=id,name
change it to this
your_fb_id?fields=id,name,accounts and press send.
You'll get all the pages wich you're administrator, choose the one you want by clicking on the respective ID. Now you're querying the page you've chosen. Last step, on the input to make queries change it to this:
your_page_id?fields=likes
EDIT
The previous request only returned the number of total likes made by the page.
To get the likes made by the page on other pages you have to use FQL Query
Change from Graph API to FQL Query and paste this
SELECT page_id, name FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid = your_PAGE_ID)
This is without doing any code, if you want to get the information and format it on your own way, you'll have to develop an app where you grant the permission manage_pages and user_likes(this one I don't think is mandatory though), use the graph api to get the likes and format the json returned data

How to check if a Facebook page post shared by a certain user?

I need a way to learn if a user had shared a post (link, video, photo etc.) which is published by a Facebook page. I have the object_id and link of the post, and user_id of the user considered. Is there a Graph API or FQL (or something else) solution to ask Facebook if the user re-shared the post or not? Or is it possible to get a list people who shared the post? So, I can extract my answer from this list.
Note that I know it is possible to find the answer by crawling the user's wall feed. But it is time consuming and I need a more efficient way.
Thanks in advance.
You can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the page in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that's the query to get what you want.

How to get category specific likes for a facebook user using graph API

I'm pretty new at this. I was playing with the Facebook Graph API and was able to pull all my LIKES using the call
$all_likes = json_decode(file_get_contents('https://graph.facebook.com/me/likes?access_token='.[access_token]));
Now when I display these, they have a field called category which has different values like TV Show, Book, Public Figure etc.
So my question is how do I get category specific likes - for instance I just want to fetch ALL the BOOKS that I LIKE
Obviously its possible to fetch all the likes and store them on the server side and work on it but the LIKES list is too huge for certain users and it doesn't make sense to pull everything if you just want to show a certain category.
I feel like I'm missing something.
If its not possible through the graph API call, then even a FQL solution is welcome.
Thanks for your time
R
You can use FQL, just like in this answer:
SELECT page_id FROM page_fan WHERE uid=me() AND type="MOVIE"

Facebook and suggestions

I'm trying to write a simple application that finds out who liked your page. I used FQL and a query very similar to:
$query = 'SELECT user_id FROM like WHERE object_id="149187568469862"';
The first issue is that FB returns an empty array. Maybe the data will be available in the near future.
I will describe the most important issue. If the user X liked my page, I would like to know who suggested X to like my page. Maybe nobody, but there are chances that X pressed "Like" after a suggestion coming from a friend. I browsed the documentation, but I didn't find relevant information about how can I see who liked my page as a result of a suggestion. Do you have any ideas?
Thanks,
As far as I know you can not retrieve any historical information on who referred a "like". Furthermore, as of right now facebook does not seem to allow querying for all your pages "fans" (which is basically everyone who likes your page). They do, however allow looking up all pages that a user "likes" using fql. Much of their documentation is very "skinny" on examples. I actually learned the most by downloading the facebook connect javascript toolkit which came with some client side examples of the most used functionality. https://github.com/facebook/connect-js - this may be a good place to start

Ways to query Facebook Graph "do I like x?"

I'm setting up my app to basically do what the FBML 'like' button does: like, unlike and show like count, for objects from the user's "me/home" stream.
I have no problem doing any of the above functions, but I'm having a very tough time getting the api to tell me if the user likes the thing already (so I can set the button to 'unlike'). The graph api is telling me I'm not allowed to search user's likes. Is there an FQL solution?
Thanks
There is like table where you can check through FQL if someone likes something.