Facebook how to get actual photo URL using Graph API?

后端 未结 5 981
囚心锁ツ
囚心锁ツ 2021-02-05 11:44

It is possible to get the actual image url of a Facebook image using the Graph api??

For instance, for the below photo http://www.facebook.com/photo.php?fbid=3577553076

5条回答
  •  庸人自扰
    2021-02-05 12:00

        new GraphRequest(
                facebookToken,
                String.format("/%s/photos", idAlbum),
                parameters,
                HttpMethod.GET,
                response -> {
                    try {
                        JSONArray photoArray = response.getJSONObject().getJSONArray("data");
                        photosAlbumAfterPagination = response.getJSONObject().getJSONObject("paging").getJSONObject("cursors").getString("after");
                        Gson gson = new Gson();
                        Type type = new TypeToken>() {
                        }.getType();
                        List list = gson.fromJson(photoArray.toString(), type);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
        ).executeAsync();
    

提交回复
热议问题