网络爬虫与 Html 解析器

Web Crawler vs Html Parser

网络爬虫和解析器有什么区别?

在java中有一些用于获取库的名称。例如,他们将 nutch 命名为爬虫,将 jsoup 命名为解析器。

Are they do the same purpose?

他们在工作中是否完全相似?

谢谢

在维基百科上查找这个问题很容易回答:

A parser is a software component that takes input data (frequently text) and builds a data structure

https://en.wikipedia.org/wiki/Parsing#Computer_languages

A Web crawler, sometimes called a spider or spiderbot and often shortened to crawler, is an [Internet bot] that systematically browses the World Wide Web, typically for the purpose of Web indexing (web spidering).

https://en.wikipedia.org/wiki/Web_crawler

jsoup 库是一个 Java 用于处理现实世界 HTML 的库。它能够 获取 并使用 HTML。但是,它通常 不是 网络爬虫,因为它一次只能获取一页(无需使用 jsoup 编写自定义程序(=爬虫)来获取、提取和获取新网址)。

网络爬虫使用 HTML 解析器从先前获取的网站中 提取 URL 并将这个新发现的 URL 添加到它的前沿

可以在这个答案中找到网络爬虫的一般序列图:

总结一下:

HTML 解析器是 Web 爬虫的必要组件,用于从给定的 HTML 输入中解析和提取 URLs。但是,单独的 HTML 解析器 不是 网络爬虫,因为它缺少一些必要的功能,例如维护以前访问过的 URLs、礼貌等