How do I retrieve photos from a Facebook group using the GraphAPI?

不问归期 提交于 2019-12-04 08:05:31

问题


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.


回答1:


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




回答2:


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?




回答3:


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




回答4:


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.




回答5:


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



来源:https://stackoverflow.com/questions/4869595/how-do-i-retrieve-photos-from-a-facebook-group-using-the-graphapi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!