这是一个web搜索的基本程序,从命令行输入搜索条件(起始的URL、处理url的最大数、要搜索的字符串),它就会逐个对Internet上的URL进行实时搜索,查找并输出匹配搜索条件的页面。
先请看程序运行的过程:
D:\java>javac SearchCrawler.java(编译) D:\java>java SearchCrawler http://127.0.0.1:8080/zz3zcwbwebhome/index.jsp 20 java Start searching... result: searchString=java http://127.0.0.1:8080/zz3zcwbwebhome/index.jsp http://127.0.0.1:8080/zz3zcwbwebhome/reply.jsp http://127.0.0.1:8080/zz3zcwbwebhome/learn.jsp http://127.0.0.1:8080/zz3zcwbwebhome/download.jsp http://127.0.0.1:8080/zz3zcwbwebhome/article.jsp http://127.0.0.1:8080/zz3zcwbwebhome/myexample/jlGUIOverview.htm http://127.0.0.1:8080/zz3zcwbwebhome/myexample/Proxooldoc/index.html http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=301 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=297 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=291 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=286 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=285 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=284 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=276 http://127.0.0.1:8080/zz3zcwbwebhome/view.jsp?id=272 又如: D:\java>java SearchCrawler http://www.sina.com 20 java Start searching... result: searchString=java http://sina.com http://redirect.sina.com/WWW/sinaCN/www.sina.com.cn class=a2 http://redirect.sina.com/WWW/sinaCN/www.sina.com.cn class=a8 http://redirect.sina.com/WWW/sinaHK/www.sina.com.hk class=a2 http://redirect.sina.com/WWW/sinaTW/www.sina.com.tw class=a8 http://redirect.sina.com/WWW/sinaUS/home.sina.com class=a8 http://redirect.sina.com/WWW/smsCN/sms.sina.com.cn/ class=a2 http://redirect.sina.com/WWW/smsCN/sms.sina.com.cn/ class=a3 http://redirect.sina.com/WWW/sinaNet/www.sina.net/ class=a3 D:\java> |
[1] [2] 下一页