📄 logurl.java
字号:
package net.matuschek.examples;
import java.io.FileWriter;
import java.net.URL;
import net.matuschek.http.URLLogger;
import net.matuschek.spider.WebRobot;
/*********************************************
Copyright (c) 2001 by Daniel Matuschek
*********************************************/
/**
* This example program downloads a web page. It does not
* store the documents but only logs the visited URLs.
*
* @author Daniel Matuschek
* @version $Revision: 1.2 $
*/
public class LogURL {
public static void main(String[] args)
throws Exception
{
System.out.println("URLs will be logged to urls.txt\n\n");
WebRobot robby = new WebRobot();
robby.setStartURL(new URL("http://www.matuschek.net"));
robby.setMaxDepth(1);
robby.setSleepTime(0);
FileWriter logfile = new FileWriter("urls.txt");
URLLogger log = new URLLogger(logfile);
robby.setDocManager(log);
robby.run();
logfile.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -