【问题标题】:extract complete content of websites via feed in php通过 php 中的提要提取网站的完整内容
【发布时间】:2012-02-28 02:25:02
【问题描述】:

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

【问题讨论】:

    标签: php feed simplepie


    【解决方案1】:

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

    你应该可以这样使用它:

    $page = file_get_contents($item_url);
    $readability = new Readability($page);
    if ($result = $readability->init()) {
        $content = $readability->getContent()->innerHTML;
    }
    

    【讨论】:

    • @drtanz 修复了这个问题,看起来他们重组了他们的网站。
    【解决方案2】:

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

    $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 可以为其产品收费是有原因的。

    【讨论】:

    • OP 本质上想要上述链接全文提要的免费版本。
    【解决方案3】:

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

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

    【讨论】:

    • Ahmad 正在寻找一个免费脚本,它可以获取提要,然后获取新闻项目的全部内容,而不仅仅是提要摘录
    猜你喜欢
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 2017-04-03
    • 1970-01-01
    • 2014-10-07
    • 1970-01-01
    • 2013-02-07
    • 2013-06-15
    相关资源
    最近更新 更多