从博客文章中检测和提取文章内容/评论的最佳方法是什么

发布于 2024-11-30 22:59:44 字数 263 浏览 6 评论 0原文

我有博客文章(示例 1示例 2)。解析 HTML 并检测作者、标题、日期、文章内容、评论(单独)的最佳方法是什么。应跳过所有其他内容。

I have blog post (sample 1, sample 2). What is the best way to parse HTML and detect author, title, date, article content, comments (separately). Whole other content should be skipped.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

水波映月 2024-12-07 22:59:44

假设您的博客网站有 RSS 提要,您可以使用 Java 的 SAX 解析器来浏览 XML

http://download.oracle.com/javase/1.4.2/docs/api/javax/xml/parsers/SAXParser.html

这是一个使用 SAX 解析 RSS 的示例解析器

http://javabeanz.wordpress.com/2007/07/25/rss-parser-sax/

Assuming your blogsite has an RSS feed, you can use Java's SAX Parser to whip through the XML

http://download.oracle.com/javase/1.4.2/docs/api/javax/xml/parsers/SAXParser.html

Here's an example of someone parsing an RSS using a SAX Parser

http://javabeanz.wordpress.com/2007/07/25/rss-parser-sax/

莳間冲淡了誓言ζ 2024-12-07 22:59:44

您可能无法获得所需的所有内容,但我认为 Boilerpipe 值得一看。

You may not get everything you are looking for but I think Boilerpipe is worth looking at.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文