用于检测网页上的列表项的 Java 库
现在的大多数网页都包含内容列表或大量重复的 html 模式块。
例如:
- 主页上的 Facebook 状态消息。
- Digg/Hacker News
- StackOverflow 主页
是否有用于检测此类列表的 Java 库。它将涉及一定量的模式匹配和智能。谢谢。
Most of the webpages now-a-days contain lists of things, or chunks of html patterns that repeat a lot.
For example:
- Facebook status messages on homepages.
- Digg/Hacker News
- StackOverflow homepage
Is there a Java library for detecting such lists. It will involve some amount of pattern matching and intelligence. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 XPath 表达式和 HTML 元素“id”属性之间,您应该能够找到您感兴趣的列表的根,然后更多的 XPath 将允许您迭代它们。
如果您还没有 XPath,我建议使用 HtmlUnit。是的,它是用于测试的,但它作为“无头”浏览器运行得非常好,并且对页面 DOM 上的 XPath 提供了出色的支持。
Between XPath expressions and HTML element "id" attributes you should be able to find the root of the lists you are interested in, and then more XPath will let you iterate over them.
If you don't have XPath already, I recommend using HtmlUnit. Yeah, it's meant for testing, but it works really well as "headless" browser and has excellent support for XPath-ing your way around the DOM of a page.
您可能想在谷歌上调查“scraper”一词。从网页中精确提取数据被笼统地称为抓取,而不是捕获整个页面的“爬行”。
You might want to investigate the term 'scraper' on google. Pin-point extraction of data from web-pages is loosely called scraping as opposed to capturing the whole page 'crawling'.