WebCrawler

WebCrawler

WebCrawler is a metasearch engine that blends the top search results from Google Search and Yahoo! Search. WebCrawler also provides users the option to search for images, audio, video, news, yellow pages and white pages. WebCrawler is a registered trademark of InfoSpace, Inc. It went live on April 20, 1994 and was created by Brian Pinkerton at the University of Washington.[2]

(译:

      WebCrawler是一个元搜索引擎混合了来自Google Search和Yahoo! Search的顶端搜索结果。WebCrawler也提供给用户选项去搜索图片、音频、视频、新闻、yellow pages和white pages。WebCrawler是一个在InfoSpace(美国著名的搜索引擎上市公司)注册的商标。华盛顿大学的Brian Pinkerton创建并在1994年4月20日启动。

     WebCrawler是第一个提供全文本搜索的web搜索引擎,在1995年6月1日被America Online公司收购并且在1997年4月1日卖给了Excite公司。WebCrawler在2001年eXcite破产之后归属于InfoSpace.InfoSpace也用于和操作元搜索引擎Dogpile 和 MetaCrawler。WebCrawler原始是一个有自己数据库的separate search engine,并且展示展示广告结果,更多的最近他已经重定位为一个元搜索引擎。)

转载于:https://www.cnblogs.com/s1-myblog/p/6197426.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是修改后的WebCrawler.java代码,请仔细查看注释: ```java import java.util.*; import java.net.*; import java.io.*; public class WebCrawler { public static void main(String[] args) { Scanner input = new Scanner(System.in); //从用户输入中获取起始URL和要搜索的关键字 System.out.print("Enter the starting URL: "); String startingURL = input.nextLine(); System.out.print("Enter the keyword to search for: "); String keyword = input.nextLine(); //创建一个HashSet来存储已访问的URL HashSet<String> urls = new HashSet<>(); //将起始URL添加到HashSet中 urls.add(startingURL); //不断从HashSet中获取URL并解析它们 while (!urls.isEmpty()) { String urlString = urls.iterator().next(); urls.remove(urlString); //如果URL以"http"开头,则继续解析 if (!urlString.startsWith("http")) continue; //如果该URL已经被访问,则跳过 if (urls.contains(urlString)) continue; //将该URL添加到已访问的URL集合中 urls.add(urlString); try { URL url = new URL(urlString); Scanner urlInput = new Scanner(url.openStream()); //读取该URL的内容,并在其中查找关键字 while (urlInput.hasNext()) { String line = urlInput.nextLine(); if (line.contains(keyword)) { System.out.println("Keyword found at " + urlString); return; } } } catch (Exception ex) { System.out.println("Error: " + ex.getMessage()); } } System.out.println("Keyword not found."); } } ``` 请注意,该程序会从用户输入中获取起始URL和要搜索的关键字,并不断地从已访问的URL列表中获取URL并解析它们,直到找到包含关键字的页面或没有更多的未访问的URL为止。如果找到了包含关键字的页面,则程序会打印该页面的URL并终止。如果没有找到包含关键字的页面,则程序会打印一条消息并终止。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值