我正在使用jFeed来检索Facebook页面的RSS提要。我可以手动导航到RSS非常好(https://www.facebook.com/feeds/page.php?format=atom10&id=12345),但是当我尝试使用下面的代码时,我最终得到了错误“不允许使用访问控制-允许-原产地”。
jQuery.getFeed({
url: 'https://www.facebook.com/feeds/page.php?format=atom10&id=12345',
success: function (feed) {
alert(feed.title);
}
});我假设这是由于它需要OAuth 2.0,但我真的需要一个“沉默”的解决方案,这样人们就不必有一个脸谱帐户或与任何方式的互动。
发布于 2012-04-07 22:50:13
让它起作用!我使用应用程序ID和秘密代码获取access_token,然后使用jquery方法获取数据。工作就像一个魅力,没有facebook的要求!
appID = '' //myappid
secretCode = '' //app "secret code"
authURL = 'https://graph.facebook.com/oauth/access_token?client_id=' + appID + '&client_secret=' + secretCode + '&grant_type=client_credentials'
feedURL = 'https://graph.facebook.com/' + appID + '/feed?'
function getFeed() {
$.get(authURL, function (accessToken) {
$.getJSON(feedURL + accessToken, function (data) {
$.map(data.data, function (item) {
alert(item.message);
//type: status, photo
//likes.count
//from.name
//created_time
});
});
});
};很明显,除了“警觉”之外,你还想做些什么,但它很有效。和我发现的任何东西相比都很简单。
发布于 2012-04-08 18:49:37
你可以看看https://github.com/dawanda/jquery-rss。它使用的是google的提要API。
https://stackoverflow.com/questions/10058564
复制相似问题