Is it possible to get all liked movie pages via FQL?
The most stable way currently to get the names of the pages not necessarily the ids would be to run a query on the user table. page_fan returns little to no results even though the user may have numerous pages likes of type Movie.
SELECT movies from user where uid=me() and movies != ''
or for all friends
SELECT movies from user where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and movies != ''
There is currently no way to get all like movie pages of a user (in terms of ids) via FQL.
Update: I jumped the gun.
This should work
SELECT name, page_id from page where page_id in (SELECT page_id from page_fan where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and profile_section='movies')
Though it's still unstable and doesn't return all matches >.<
Yes it is. Check out the Graph API Explorer. You can run FQL statements on the page_fan table from there. You'll need to require the user_likes permission and then parse out the movie entries. that field is not index.
yes, just query the FQL page_fan table http://developers.facebook.com/docs/reference/fql/page_fan/ with the correct permissions.
Related
I cannot figure a way get friends only with profile photos. I could use multi-query to check whether every friend has a photo, but that would incur heavy traffic.
Are there any alternatives?
Although Gajus’ suggested query might work right now, it’ll break once Facebook changes the URL of the default picture on their CDN. (Might happen, might not happen.)
So I’d suggest this for improvement:
The profile_pic table has a field called is_silhouette, which is a boolean for whether the user has their own profile picture set or not.
So to get only those of your friends, that have a profile picture set, you can use
SELECT uid, name FROM user WHERE uid IN
(SELECT id FROM profile_pic WHERE
id IN (SELECT uid1 FROM friend WHERE uid2 = me() )
AND NOT is_silhouette
)
–> Try this query in the Graph API Explorer.
This can be achieved with a simple FQL.
SELECT uid, name, pic_small FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND pic_small != 'https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/yP/r/FdhqUFlRalU.jpg'
The seb-query will get all yours friend uids. The other query will match does uids with the profile data check if the pic_small is referring to what Facebook uses as a placeholder.
You can quickly test it here.
I'm trying to grab the Facebook pages that my friends liked.
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
I noticed that some data is missing from the result set, therefore I queried the table for individual user ids, as follows:
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid={id1}
SELECT uid,page_id,type,profile_section,created_time FROM page_fan WHERE uid={id2}
...
Apparently for some friend ids is working, but for some others the query returns empty result.
I thought that maybe those missing users have some privacy settings not allowing apps to pull data from their accouns.
Any thoughts?
Are you using a valid access token when making this request?
If you look at the documentation for the page_fan table it explains what access tokens are needed
https://developers.facebook.com/docs/reference/fql/page_fan/
To read the page_fan table you need:
any valid access_token if it is public (visible to anyone on
Facebook).
user_likes permissions if querying the current user.
friends_likes permissions if querying a user's friend.
select first_name, last_name, uid from user where uid in (select uid2 from friend where uid1=me() and uid2 **not** in(SELECT user_id FROM like WHERE object_id={0}))
But the not is not recognised by facebook. How do you solve this issue?
without the not, you will get the list of all friends who like something
Don't think there is a direct way to do this. You might need to do batch queries, one to get the uids of all your friends who have liked a particular object, and compare them against the list of friend-ids and eliminate the matches.
I try to find facebook api to retrieve user's friends who like the same fan page but I dont think the new graph api able to do this.
While searching in the stackoverflow, I came out with this FQL:
select user_id from like where object_id = "[page_id]" and user_id in (select uid2 from friend where uid1 = me())
but facebook return me with
array(0) {
}
is there any solution ?
You can do this with FQL:
SELECT uid FROM page_fan
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND page_id = "[fan_page_id]"
Which returns you friends who are fans of given fan page ([fan_page_id]). It works at this moment quite well.
Is there any fql statements allowed by facebook that helps to fetch contents of this page through an application interface: http://www.facebook.com/posted.php I know the links table returns the posted item for a logged in user (http://developers.facebook.com/docs/reference/fql/links). I need the same but for the logged-in user's friends.
Thanks.
you can use Fql query or Graph API to get your friends data.
Sometimes you will not get all information from the graph like birthdate of your friends but yes you can use fql queries to solve your probs.
here is an exmple for you.
create first facbook object and the use it.
$query = "SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 0 ORDER BY birthday_date";
Regards,
Archit.
You can do this through an FQL query - though you may need to use multiple queries if you require more information about the friend who posted the link:
select title, owner from link where owner in (select uid2 from friend where uid1 = me() limit 100)
You may want to limit the number of friends (or even the links themselves) as this can be a costly query