8

I am an admin of a private group in facebook and I would like to use facebook API to scrap all group posts.

I used graph api explorer to generate an access token with read_stream, friends_group and user_groups permissions.

When I access the group post with https://graph.facebook.com/GROUP_ID/feed?access_token=TOKEN I get a data array with each post but the caption element has the value

"Attachment UnavailableThis attachment may have been removed or the person who shared it may not have permission to share it with you." and all the other fields such as link, message, etc ... are not present.

If I open the facebook group using the browser I can see all posts.

Am I missing something here ?

Somnath Muluk
  • 55,015
  • 38
  • 216
  • 226
sergiofbsilva
  • 1,606
  • 15
  • 20
  • Is it a Private group that you admin ? Are you unable to view the posts made by users of the group ? If so, sounds like a bug that you should file here - https://developers.facebook.com/bugs – deesarus Sep 05 '12 at 18:02
  • Well the posts are present in the json object but I can't get its content. I think the problem is that when the type of the post is status you don't get any other info than caption which is not useful for me. Actually the type "status" is not even in the documentation of [Post](https://developers.facebook.com/docs/reference/api/post/) – sergiofbsilva Sep 05 '12 at 19:13
  • 2
    I've created a bug issue in facebook, please feel free to subscribe it and mark it as replayable.https://developers.facebook.com/bugs/382129358523494?browse=search_510934aadfa685a54627700 – sergiofbsilva Jan 30 '13 at 14:58

2 Answers2

0

This issue appears to have been corrected. I can access all the Group content for my private group as long as I have a valid Auth Token.

Colin Smillie
  • 431
  • 3
  • 7
0

Below is the code where I fetch the posts of a group in a JSON Object. This JSON object contains a JSON Array of "data". This further contains a separate JSON array for messages (or status of the post).

GraphRequest.newGraphPathRequest(
            accessToken, "/id/posts",
            new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse      graphResponse) {

                    try {
graphResponse.getRawResponse();

                        m=graphResponse.getJSONObject();
                        JSONArray n=m.getJSONArray("data");
                        messages=new String[n.length()];
                        for(int i=0;i<n.length();i++) {
                            JSONObject a = n.getJSONObject(i);
                            messages[i]=a.optString("message");
                        }

                        list.setAdapter(new   ArrayAdapter<String>   (fb.this,android.R.layout.simple_list_item_1,messages));

                    } catch (Exception e) {
                        Toast.makeText(fb.this, "error is: " +   e.toString(), Toast.LENGTH_LONG).show();
                    }
                }
            }).executeAsync();
Pang
  • 9,564
  • 146
  • 81
  • 122