page/feed 的未知错误 - Facebook 图 api
Unknown Error with page/feed - Facebook graph api
我无法通过图表从 Facebook 页面检索帖子 API。
这是我使用的代码:
FB.api(
'/'+account+'/feed',
{
access_token : options.facebook.access_token,
limit: options.facebook.limit
},
function(response) {
doThingsWithResponse(response);
}
);
这是我收到的错误:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
似乎有一个与此相关的错误:
https://developers.facebook.com/bugs/328424960681438/
我找到了一个可以同时使用的解决方案:
FB.api(
'/'+account+'/feed',
{
access_token : options.facebook.access_token,
limit: options.facebook.adjustedLimit
},
function(response) {
if (response.error.code == 1){
FB.api(
'/'+account+'/promotable_posts',
{
access_token : options.facebook.access_token,
limit: options.facebook.adjustedLimit
},
function(response) {
Feed.facebook.utility.getPosts(response);
});
}
else {
Feed.facebook.utility.getPosts(response);
}
}
);
在 API 调用的回调中,我检查是否有错误,如果有,我将调用更改为 /promotable_posts
,因为那个调用似乎仍在正常工作。
与此相关的一个问题是,在 promotable_posts
内,我收到类似 "Name commented on a photo."
的帖子
所以在 doThingsWithResponse()
里面,我像这样过滤掉那些评论:
// reset adjustedLimit to base limit
options.facebook.adjustedLimit = options.facebook.limit;
response['data'].forEach(function(element) {
if (!element.story || element.story.indexOf("commented on") == -1){
// the post is worthwhile, so do things with it
doThingsWithPost(element);
}
else if (options.facebook.limit) {
// increase the limit for each post that gets removed
options.facebook.adjustedLimit++;
}
});
我无法通过图表从 Facebook 页面检索帖子 API。
这是我使用的代码:
FB.api(
'/'+account+'/feed',
{
access_token : options.facebook.access_token,
limit: options.facebook.limit
},
function(response) {
doThingsWithResponse(response);
}
);
这是我收到的错误:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
似乎有一个与此相关的错误: https://developers.facebook.com/bugs/328424960681438/
我找到了一个可以同时使用的解决方案:
FB.api(
'/'+account+'/feed',
{
access_token : options.facebook.access_token,
limit: options.facebook.adjustedLimit
},
function(response) {
if (response.error.code == 1){
FB.api(
'/'+account+'/promotable_posts',
{
access_token : options.facebook.access_token,
limit: options.facebook.adjustedLimit
},
function(response) {
Feed.facebook.utility.getPosts(response);
});
}
else {
Feed.facebook.utility.getPosts(response);
}
}
);
在 API 调用的回调中,我检查是否有错误,如果有,我将调用更改为 /promotable_posts
,因为那个调用似乎仍在正常工作。
与此相关的一个问题是,在 promotable_posts
内,我收到类似 "Name commented on a photo."
所以在 doThingsWithResponse()
里面,我像这样过滤掉那些评论:
// reset adjustedLimit to base limit
options.facebook.adjustedLimit = options.facebook.limit;
response['data'].forEach(function(element) {
if (!element.story || element.story.indexOf("commented on") == -1){
// the post is worthwhile, so do things with it
doThingsWithPost(element);
}
else if (options.facebook.limit) {
// increase the limit for each post that gets removed
options.facebook.adjustedLimit++;
}
});