1 package net.matuschek.examples; 2 3 import java.io.FileWriter ; 4 import java.net.URL ; 5 import net.matuschek.http.URLLogger; 6 import net.matuschek.spider.WebRobot; 7 10 11 12 13 20 public class LogURL { 21 22 public static void main(String [] args) 23 throws Exception 24 { 25 System.out.println("URLs will be logged to urls.txt\n\n"); 26 27 WebRobot robby = new WebRobot(); 28 robby.setStartURL(new URL ("http://www.matuschek.net")); 29 robby.setMaxDepth(1); 30 robby.setSleepTime(0); 31 32 FileWriter logfile = new FileWriter ("urls.txt"); 33 URLLogger log = new URLLogger(logfile); 34 robby.setDocManager(log); 35 36 robby.run(); 37 logfile.close(); 38 } 39 } 40 41 | Popular Tags |