【问题标题】:How to extract news content from a web page using Boilerpipe?如何使用 Boilerpipe 从网页中提取新闻内容?
【发布时间】:2012-04-21 08:59:24
【问题描述】:

我需要从网页中提取主要新闻内容。我在互联网上搜索并发现一个名为 Boilerpipe 的 API 可免费用于此目的http://boilerpipe-web.appspot.com/ 但我无法在 java 中找到任何使用 Boilerpipe 的实现.谁能告诉我如何在 Java 中使用 Boilerpipe 来提取新闻内容或给我一些 Java 实现的链接,这些实现使用 Boilerpipe 从新闻网页中提取内容?

【问题讨论】:

  • 您是否考虑过使用 Jsoup 之类的库? jsoup.org您是否有要抓取的特定网站?

标签: java web html-parsing web-scraping boilerpipe


【解决方案1】:

简单吧, 假设你需要提取这个URL

只需使用我的 BoilerPipe Alternative Web API HERE, 我的服务基于boilerpipe,我之所以开发这个是因为在原始应用程序中出现了overquota错误。你可以选择以JSON格式取回结果,只需在你的应用程序中使用它。

最好的问候

【讨论】:

    【解决方案2】:

    可能是我的回答为时已晚。但这很简单。

     URL url = new URL("http://www.nydailynews.com/sports/baseball"); 
     ArticleExtractor ae = new ArticleExtractor();
     String content = ae.getText(url);  // this contains the final text
    

    【讨论】:

      猜你喜欢
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-10
      • 2011-02-14
      • 1970-01-01
      • 2013-02-16
      • 1970-01-01
      相关资源
      最近更新 更多