2

我想通过提要获得新闻或网站帖子的完整内容。但我们知道,许多网站只通过他们的提要展示部分新闻或帖子。
当然,我知道存在一个名为的脚本,该脚本SimplePie是为通过提要获取网站内容而开发的。但此脚本不会检索新闻的全部内容。
当然,我找到了一个名为Full-Text Feedsdo It 的脚本。但它不是免费的。我想要一个免费的脚本。
你知道一个类似的脚本或方法来满足我的需要吗?

4

3 回答 3

9

Five Filters 内容提取背后的代码实际上是开源的,并且基于 Readability 的原始 Javascript(在它们成为服务之前)。

您应该可以像这样使用它:

$page = file_get_contents($item_url);
$readability = new Readability($page);
if ($result = $readability->init()) {
    $content = $readability->getContent()->innerHTML;
}
于 2012-02-06T17:19:12.507 回答
0

不完全确定您要在这里做什么,但这可能会对您有所帮助:

$full_page_content = file_get_contents('http://www.example.com/');

编辑:好的,如果我理解正确,你需要做这样的事情:

Get rss feed
Use SimplePie or something like it to go through each feed item
For each item in RSS feed
  Get the item's url
  Get the content from that URL
  Strip out the HTML/extract only the text you need
Combine all of these into a new RSS feed and send that to the user

注意:这不是一件简单的事情。Full-Text RSS 可以为其产品收费是有原因的。

于 2012-02-06T16:19:19.300 回答
-2

您可以使用http://magpierss.sourceforge.net/cookbook.shtml(免费)

它检索 RSS 提要。在网络上有很多很多 PHP 脚本可以做到这一点......谷歌是你的朋友!:)

于 2012-02-06T16:07:26.973 回答