1

I want to get all the photos posted by user in facebook using spring social facebook. I am able to get connected and able to retrieve user name and id, but when i am trying to retrieve album of photos, i am getting zero result . I tried using FQL operations and graph api. following is my code which i am using for getting album.

PagedList<Album> albums = facebook.mediaOperations().getAlbums();
        System.out.println(facebook.mediaOperations().toString());
        System.out.println(facebook.GRAPH_API_URL);

        // System.out.println(albums.size());
        // List<Photo> images = new ArrayList<Photo>();
        // for (Album album : albums) {
        // images.addAll(facebook.mediaOperations().getPhotos(album.getId()));
        // }

        String query = "SELECT pid, src, src_small, src_big, caption FROM photo WHERE owner= me()";

        List<Image> images = facebook.fqlOperations().query(query,
                new FqlResultMapper<Image>() {

                    public Image mapObject(FqlResult result) {

                        Image image = new Image();
                        image.setPid(result.getString("pid"));
                        image.setSrc(result.getString("src"));
                        image.setSrc_small(result.getString("src_small"));
                        image.setSrc_big(result.getString("src_big"));

                        return image;

                    }
                });
4

1 回答 1

2

我刚刚尝试了一些类似于您拥有的注释代码的东西,它对我来说效果很好。我最终收到了该用户所有相册中授权用户的所有照片。

用户是否可能没有“user_photos”权限?或者......也许没有相册/照片?或者可能,设置了这些相册和/或照片的权限,以便应用程序无法通过 API 看到它们?

于 2014-07-28T15:53:48.243 回答