I need to get all public videos from an particular user account. I have a valid default access token. But it doesn't return anything when I request videos using FQL or graphAPI.
SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner=
FB document says that I can get publicly available videos by any valid access token.
http://developers.facebook.com/docs/reference/fql/video/
Any valid access_token for publicly available videos
I used facebook explorer tool test this but it is not working for me.
http://developers.facebook.com/tools/explorer/
Please let me know if I do anything wrong. I just need to get public videos from user profile. I can use user_videos permission to get both public and private videos. But there is no flag to identify that whether the particular video is public or private.
Please help me on this.
Thanks and Regards,
Malligairajan G.
go to the explorer and do the sample query code that they give you, which is as follows:
SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner=20531316728
Before doing the query, you have to press the button "get access token". I checked user_videos in the authorization, but maybe it is not required. After you get the access token, press the button "FQL query" (not Graph Api), insert the query above, press submit.
This is the result I get (first result. the whole thing is too long):
{
"data": [
{
"vid": "10200156550214780",
"owner": 20531316728,
"title": "Building Graph Search",
"description": "Learn about the design and engineering behind Graph Search (http://fb.com/graphsearch).",
"thumbnail_link": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632230_10200156572295332_10200156550214780_21792_636_t.jpg",
"embed_html": "<iframe src=\"https://www.facebook.com/video/embed?video_id=10200156550214780\" width=\"1280\" height=\"720\" frameborder=\"0\"></iframe>",
"updated_time": 1358280001,
"created_time": 1358280001
},
both the graph api and your app won't work if you don't authorize with user_videos permissions. In other words you need an authorization even to fetch public data.
try this FQL query:
{"SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner== me()" }
Related
How can i get, using Facebook Graph Api, all my posts to other people, not to my timeline?
I'm trying to use me/posts , but i get all my posts including to my timeline, and i couldn't separate it
Using Facebook FQL API:
SELECT post_id, created_time, description, description_tags, app_id,
message, type, created_time FROM stream WHERE source_id=me() AND
comment_info.can_comment!='' AND actor_id=me() AND permalink="" AND
created_time<=now() LIMIT 150
The only problem is this query doesn't return "Upload photo on friends wall"'s post, because of this unresolved bug at https://developers.facebook.com/bugs/148353975327544. However, this FQL query should works perfectly. Kindly let me know if you're figure out something wrong with this query.
Also, please make sure your user access token have granted "read_stream" permission.
comment_info.can_comment!='' used to exclude "Comment on friend's Status" story feed.
permalink="" used to exclude "Lim and 林果皞 are now friends." or "People changed his profile picture.", "林果皞 created an event."...etc. You can test what would happen if remove this.
Update for comment below:
I think what you can do is extract the id from description_tags which was no start with "0", for example my screenshot, id "100003013144869":
Also, extract the created_time, for example "1368624514"
Then, do a query with:
SELECT post_id FROM stream WHERE source_id='100003013144869' AND
actor_id=me() AND created_time=1368624514
I'm know it's not absolutely accurate(If 2 feed have the same created_time on seconds), however most likely you can make your job done.
I wrote a query, trying to all the comments, given on my albums. The query I use is the following :
SELECT fromid, user_likes, text, time FROM comment
WHERE object_id IN
(
SELECT object_id FROM photo
WHERE aid IN (
SELECT aid FROM album WHERE owner=me()
)
)
In my case, when I test it on the developers site, it just returns:
{
"data": [
]
}
So I figured my query wasn't wrong because it returns no error so I asked a friend to try it and he did get all his comments on albums. The test page I used it the following :
http://developers.facebook.com/tools/explorer/?fql=SELECT%20fromid%2C%20user_likes%2C%20text%2C%20time%20FROM%20comment%20%0AWHERE%20object_id%20IN%20%0A(%20%0A%20%20%20%20SELECT%20object_id%20FROM%20photo%0A%20%20%20%20WHERE%20aid%20IN%20(%20%0A%20%20%20%20%20%20%20%20SELECT%20aid%20FROM%20album%20WHERE%20owner%3Dme()%20%0A%20%20%20%20)%0A)%0A
And yes, I do have a valid access token because the following query does work:
SELECT object_id FROM photo
WHERE aid IN (
SELECT aid FROM album WHERE owner=me()
)
Is it possible it doesn't work because I'm a new user on facebook? Or can it be that it's a privacy setting? I compared all my privacy setting (album and profile) with my friend and we have exactly the same so I don't think so.
Also when I share an album with a link (go to album, click on wheel, share, copy link), people have to log in on facebook before they can see the album and if my friend does the same, people can watch it without being logged in (like it is suppose to work). Maybe this has something to do with it?
I tried google, facebook help, calling facebook and even looking for answers on the developer pages and this forum but no luck. So you guys are basically my final hope...
Thanks a million
De Wesp!
you may have got this error
{
"error": {
"message": "(#601) Parser error: unexpected end of query.",
"type": "OAuthException",
"code": 601
}
}
this is because when you creating an app you should create a token access for your apps.
Please let me know if it does not work.
I have created a test user for my facebook app and filled in the fields for name, profile picture, music, tv, movies, books, actvities and interests. The information is there and I can view it in the profile, but for some reasons in spite of having specified what appear to be the correct permissions, I cannot access this information even through the Grap API explorer when I am logged in as the user.
When I go to the Graph API explorer, go to the FQL tab and launch the following query I only get certain fields:
SELECT name,pic_big,music,tv,movies,books,email FROM user WHERE uid = me()
The response is:
{
"data": [
{
"name": "Aisha Bibi",
"pic_big": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/274348_100004159483336_574477135_n.jpg",
"music": "",
"tv": "",
"movies": "",
"books": "",
"email": "aisha_gjmodrm_bibi#tfbnw.net"
}
]
}
I generated the access token for this request by selecting the following user data permissions: email, user_activities, user_education_history, user_interests.
Could anybody tell me why it is failing to retrieve information for the user even though it is present on the profile, I have detailed the correct permissions(?) and I am logged in as them while accessing the Graph API explorer tool?
Thanks in advance :D
I am sorry - I did not read the documentation clearly enough it seems. In order to access the user's music and movies etc you need the user_likes permission. I hope this helps somebody!
When I access the list of my friends using the URL https://graph.facebook.com/me/friends?access_token=... I can see the list of my friends. I can do this programmatically as well.
Now, when I take the ID of any of my friends and replace it with "me" in the above URL, and paste the URL in the browser, I can see my friend's friends. I am unable to do this programmatically because it is giving me an HTTP 400 ERROR.
Does anyone know why this is possible by pasting the URL and not programmatically?
You can not get the "friends of friends" using the facebook api.
For example, try the simple /me/friends with the Graph API Explorer, it should work fine.
Then, take one of the ids there and try the same with FRIEND_ID/friends and you should get this:
{
"error": {
"message": "(#604) Can't lookup all friends of FRIEN_ID. Can only lookup for the logged in user or the logged in user's friends that are users of your app.",
"type": "OAuthException",
"code": 604
}
}
The error itself is very straight forward and explains exactly what the problem is.
As for why that translates into a 400 error code for you is unclear.
Edit
You can't see the "friends of friends" in the browser as well, the reason that it works for you (probably) is that the user(s) you check the friends for (USER_ID/friends) installed the app that the access token belongs to, from the way you got to that url I assume that the app is the "Test_console".
How to check? Copy the access token from the url (USER_ID/friends?access_token=xxxxx), go to the Facebook Debugger and paste the token in the text field and click "Debug", it will show you info regarding the application.
The user you checked it for probably has that app "installed", if you check it for other users you will get that error when you get to a user who does not have that app "installed".
I hope this clarifies it for you.
I got friends of friends(limited) who are using application. I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.
We can get friends of friends those are app users.
$fb_id= user id whose friends of friends required.
Try this fql query.
$query="SELECT uid, name, work_history FROM user WHERE uid IN (SELECT
uid2 FROM friend WHERE uid1 IN (SELECT uid FROM user WHERE uid IN
(SELECT uid2 FROM friend WHERE uid1 = $fb_id ) and is_app_user=1) )";
It needs following requirements:
Your friend needs to be using application.
Permission from application read_stream, publish_stream, publish_checkins.
I would like to retrieve photos from a facebook group using the GraphAPI. Based on FB Docs I don't see any connections to photos. I would like to get the photos and the users who uploaded them.
Graph API:
http://graph.facebook.com/GROUP_ID/?fields=name,description,albums
return
{
"name": "Group name",
"description": "Group description",
"id": "GROUP_ID",
"albums": {
"data": [
{
"id": "GROUP_ALBUM_ID",
"name": "GROUP_ALBUM_NAME",
"link": "GROUP_ALBUM_LINK",
"created": 1352388257,
"modified": 1352388257,
"cover_pid": 444427468954616,
"count": 22
}
],
"paging": {
"next": "https://graph.facebook.com/GROUP_ID/albums?limit=25&offset=25"
}
}
}
and next query
http://graph.facebook.com/GROUP_ALBUM_ID/photos?fields=picture,source,name&type=uploaded
Ive been digging a bit in the same issue.
We have a group album which is has this url
https://www.facebook.com/media/set/?set=oa.10150651435446985
So the ID seems to be oa.10150651435446985
Another empty album gets album gets the set-id oa.10150652583791985
A note in the same group id 10150652589396985
Notice the similarity in ID's.
The direct link: http://facebook.com/10150651435446985 works to go to the album.
The album is created by user 1128233556 and the groupid is 184760601984.
Other, individual (not in an album) group photos are in "set" o.184760601984 where the digit represents the group id.
So what does "o" and "oa" stand for? a=album, o=?
Pictures have the following URL: https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s720x720/420015_3293876662264_1128233556_33234982_110700674_n.jpg
420015_3293876662264_1128233556_33234982_110700674
??????_PHOTOID_______USER_______????_____?????????
Who can make something out of al that?
I have the same problem / here is my partial answer, which remains kind of hack :
one can retrieve photos posted on a group via the FQL group.stream or the GraphAPI group.feed (playing around with the facebook graphApi explorer or the fql query/multiquery test console).
This way you can retrieve all needed information, included a valid id to retrieve the photo, and one to retrieve the object from the graph.
BUT, this is only valid for individual photos.
since my previous answer was deleted, i won't repost it here, but remind that my similar problem is detailed in this thread FQL or GraphAPI unable to retrieve PHOTO ALBUM or VIDEO posted on a GROUP , which, if ever solved, might even as well help people for this very problem here.
Thomas
I don't think Albums in groups R treated like albums on Profile pages. The pics have aid ="0" Even if they are part of albums.
I used The Image below:
https://www.facebook.com/photo.php?fbid=10151350034089218 is the link to the image. And you can guess where I got the object_ID.
In this example 10151350034089218 is the object_ID for an image in an album for my group "T_Group" The link to the group is https://www.facebook.com/groups/217697621700825/.
You can then run the FQL query
SELECT aid
FROM photo
WHERE object_id = 10151350034089218
you'll get
aid
====
0
Even though it is part of an album "Hugh Laurie".
I tried the same FQL query with images in albums on my profile and they always returned an aid with some Number other than 0.
I plan on posting to Facebook bugs, I hope I get a fix. Unless its running as intended.
I tried:
SELECT pid
FROM photo_tag
WHERE subject =217697621700825
...and I got PIDs to photos posted to the group page not images in albums.
I wish I had found a more direct method, but this appears to have promise:
get /me/groups or /me?fields=groups to get the groups ids.
From that, get {group_id}/feed?type=photo This returns just the photos from the feed, but all you really get (toward this goal) is the photo's id (returned as object_id).
Then for each photo you can get /{object_id} which returns all the links to the various sizes of the image.
I did this research in Facebook Graph Explorer, so keep that in mind as you try to implement it.
Rob