Umang Kothari
Umang Kothari

Reputation: 3694

Facebook rss feed does not work for public

(1) Using Graph API

I followed this link to get feed for public.

Bundle param = new Bundle();
        param.putString("limit", "500");
        new Request(session, "/me/feed", param, HttpMethod.GET,
                new Request.Callback() {
                    public void onCompleted(Response response) {
                        feedJson = response.getGraphObject()
                                .getInnerJSONObject().toString();
                        }
                }).executeAsync();

After parsing feedJson from according to above code, i get post's url and other stuff but that url is not working for public like if i try to access that link from another fb account then it denied to access. What to do..??

(2) Using older way

And another way to access feed is like

i) https://graph.facebook.com/[page or account name for which you want to get feed]

you get id for that page or account and then

ii) https://www.facebook.com/feeds/page.php?id= [id of your page or account]&format=rss20

then hit enter it gives like Facebook Syndication Error- SyndicationErrorFeed

What to do..??

Upvotes: 1

Views: 348

Answers (2)

Chirag Patel
Chirag Patel

Reputation: 1611

Without using the API directly (which will need you to supply an access token for a user who's able to access that content) you won't be able to access the feed of a page which is restricted. so please get id is Invalid.

my code is successfully so please try this.

// Class with extends AsyncTask class
    private class LongOperation extends AsyncTask<String, Void, Void> {

        private final HttpClient Client = new DefaultHttpClient();
        private String Content;
        private String Error = null;
        private ProgressDialog Dialog = new ProgressDialog(getActivity());

        protected void onPreExecute() {
            Dialog.setMessage("Please Wait...");
            Dialog.show();
        }

        // Call after onPreExecute method
        protected Void doInBackground(String... urls) {
            try {
                // Server url call by GET method
                HttpGet httpget = new HttpGet(urls[0]);
                ResponseHandler<String> responseHandler = new BasicResponseHandler();
                Content = Client.execute(httpget, responseHandler);

                // Log.e("Content", "" + Content);
            } catch (ClientProtocolException e) {
                Error = e.getMessage();
                cancel(true);
                Log.e("ClientProtocolException", "" + e.getMessage());
            } catch (IOException e) {
                Error = e.getMessage();
                cancel(true);
                Log.e("IOException", "" + e.getMessage());
            }

            return null;
        }

        protected void onPostExecute(Void unused) {
            // NOTE: You can call UI Element here.

            Dialog.dismiss();
            socialfeedList = new ArrayList<SocialfeedDataset>();

            try {
                JSONObject jsonObject = new JSONObject(Content.toString());
                JSONArray jsonArray = jsonObject.getJSONArray("entries");
                Log.e("jsonArray", "" + jsonArray.length());
                for (int i = 0; i < jsonArray.length(); i++) {
                    String title = jsonArray.getJSONObject(i)
                            .optString("title");
                    Log.e("title", "" + title);
                }

            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }

just Pass your url as perameter:

new LongOperation().execute(Constant.Facebook_Feed);

Upvotes: 1

The Somberi
The Somberi

Reputation: 126

I think Facebook RSS feeds are not available for private accounts. Public accounts that anyone can access without logging in have RSS accounts.

Upvotes: 0

Related Questions