使用Java进行Web抓取 [英] Web scraping with Java

查看:112
本文介绍了使用Java进行Web抓取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到任何好的网络抓取基于Java的API。我需要抓取的网站也没有提供任何API;我想使用一些pageID迭代所有网页,并在他们的DOM树中提取HTML标题/其他内容。

I'm not able to find any good web scraping Java based API. The site which I need to scrape does not provide any API as well; I want to iterate over all web pages using some pageID and extract the HTML titles / other stuff in their DOM trees.

除了网页抓取之外还有其他方法吗?

Are there ways other than web scraping?

谢谢

推荐答案

jsoup



提取标题并不困难,而且您有很多选项,请在Stack Overflow上搜索 Java HTML解析器。其中一个是 Jsoup

你可以导航如果您知道页面结构,请使用DOM页面,请参阅
http:// jsoup .org / cookbook / extraction-data / dom-navigation

You can navigate the page using DOM if you know the page structure, see http://jsoup.org/cookbook/extracting-data/dom-navigation

这是一个很好的库,我在上一个项目中使用过它。

It's a good library and I've used it in my last projects.

这篇关于使用Java进行Web抓取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆