Facebook杀死了公共RSS源; 如何使用新的时间轴获取Facebook Page RSS?
我试图从Facebook中提取RSS页面,但每次尝试尝试时,我都会在XML中收到错误信息:
<![CDATA[ This feed URL is no longer valid. Visit this page to find the new URL, if you have access: <a href="https://www.facebook.com/profile.php?id=">https://www.facebook.com/profile.php?id=</a> ]]>
我正在使用的URL是:
https://www.facebook.com/feeds/page.php?id=&format=rss20&access_token=
我没有年龄限制集也没有国家/地区限制:
此外,我已尝试使用和不使用我的访问令牌。
如下面的评论中所述,JSON URL确实有效:
https://graph.facebook.com//feed&https://www.facebook.com//feed?access_token=
这里发生了什么/我该如何解决这个问题?
我遇到了同样的问题。 在寻找解决方案后,我发现FB默默地杀死了公共RSS支持。 (见Jesse Stay的这篇文章 )
我知道我需要自己调用API并构建feed(我还需要通过WP插件和其他东西解析的feed。
因此,首先获得API密钥(也称为app id)并下载PHP Facebook SDK。
然后下载Universal Feed Generator PHP类。 它将为您生成所有必需的标头和xml。
你的PHP脚本将是这样的:
require('lib/facebook.php'); // require your facebook php sdk include("feed_generator/FeedWriter.php"); // include the feed generator feedwriter file $fb = new facebook(array( 'appId' => 'YOUR_APP_ID', // get this info from the facebook developers page 'secret'=> 'YOUR_SECRET_KEY' // by registering an app )); $response = $fb->api('/spreetable/feed','GET'); // replace "spreetable" with your fb page name or username // create the feedwriter object (we're using ATOM but there're other options like rss, etc) $feed = new FeedWriter(ATOM); $feed->setTitle('Spree Table'); // set your title $feed->setLink('http://spreetable.com/facebook/feed.php'); // set the url to the feed page you're generating $feed->setChannelElement('updated', date(DATE_ATOM , time())); $feed->setChannelElement('author', array('name'=>'Spree Table')); // set the author name // iterate through the facebook response to add items to the feed foreach($response['data'] as $entry){ if(isset($entry["message"])){ $item = $feed->createNewItem(); $item->setTitle($entry["from"]["name"]); $item->setDate($entry["updated_time"]); $item->setDescription($entry["message"]); if(isset($entry["link"])) $item->setLink(htmlentities($entry["link"])); $feed->addItem($item); } } // that's it... don't echo anything else, just call this method $feed->genarateFeed();
未来的注意事项(2013-07-09):不要再听我的回答了。 它太老了。 Facebook有一个新的API,其查询语言具有新function,所以不要费心拉动提要。 尝试以更有趣,更智能的方式使用他们的API 🙂
这是我的指示。
- 转到Facebook并右键单击配置文件图像以获取URL并复制ID
- 到这里https://graph.facebook.com/ID_GOES_HERE
- 获取结果页面上列出的ID值并将其复制
- 转到此处并粘贴新ID https://www.facebook.com/feeds/page.php?id=ID_GOES_HERE&format=rss20
- 将URL复制并粘贴到您的Feed阅读器中
当在源页面中找不到页面ID时,我通过“创建页面”链接找到了id,如
https://www.facebook.com/pages/create.php?ref_id=the_#_here
啊……好好让我的RSS反馈! 感谢大家! :d
获取RSS / Atom提要的两个简单步骤:
- 找到fb_id: http ://findmyfacebookid.com/
- 把它放在那里: https : //www.facebook.com/feeds/page.php?format = atom10&id =
此url会生成Atom Feed,但您可以更改它。
有一种更简单的方法来查找页面ID:
只需查看FB页面(或时间线应用程序,以前称为选项卡)的源代码,然后搜索page_id
。 将其替换为提供的代码。