1242. 多线程网页爬虫
给你一个初始地址 startUrl 和一个 HTML 解析器接口 HtmlParser,请你实现一个 多线程的网页爬虫,用于获取与 startUrl 有 相同主机名 的所有链接。 以 任意 顺序返回爬虫获取的路径。 爬虫应该遵循: 从 startUrl 开始 调用 HtmlParser.getUrls(url) 从指定网页路径获得的所有路径。 不要抓取相同的链接两次。 仅浏览与 startUrl 相同主机名 的链接。 如上图所示,主机名是 example.org 。简单起见,你可以假设所有链接都采用 http 协议,并且没有指定 端口号。举个例子,链接 http://leetcode.com/problems 和链接 http://leetcode.com/contest 属于同一个 主机名, 而 http://example.org/test 与 http://example.com/abc 并不属于同一个 主机名。 HtmlParser 的接口定义如下: interface HtmlParser { // Return a list of all urls from a webpage of given url. // This is a blocking call, that means it will do HTTP request and return when this