gpt4 book ai didi

android - Facebook rss feed 不适用于公众

转载 作者:行者123 更新时间:2023-11-30 02:42:31 25 4
gpt4 key购买 nike

(1) 使用图谱API

我关注了this link为公众提供饲料。

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();

根据上面的代码解析 feedJson 后,我得到了帖子的 url 和其他东西,但该 url 对公众不起作用,就像我尝试从另一个 fb 帐户访问该链接然后它拒绝使用权。怎么办..??

(2) 使用老方法

另一种访问提要的方法是

我)https://graph.facebook.com/[page或您要为其获取提要的帐户名称]

您获得该页面或帐户的id,然后

ii) https://www.facebook.com/feeds/page.php?id= [您的页面或帐户的 ID]&format=rss20

然后按回车键,它会出现类似Facebook 联合错误- SyndicationErrorFeed

要做什么..?

最佳答案

如果不直接使用 API(这将需要您为能够访问该内容的用户提供访问 token ),您将无法访问受限页面的提要。 所以请获取 id 无效。

我的代码是成功的,所以请试试这个。

// 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();
}

}
}

只需将您的网址作为参数传递:

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

关于android - Facebook rss feed 不适用于公众,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25569693/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com