progs/crawler2.scala
changeset 116 010ae7288327
parent 112 95ee5cc5c05d
child 242 35104ee14f87
--- a/progs/crawler2.scala	Fri Sep 27 15:05:50 2013 +0100
+++ b/progs/crawler2.scala	Fri Sep 27 15:43:25 2013 +0100
@@ -23,7 +23,10 @@
 
 def crawl(url: String, n: Int) : Unit = {
   if (n == 0) ()
-  else if (my_urls.findFirstIn(url) == None) ()
+  else if (my_urls.findFirstIn(url) == None) { 
+    println(s"Visiting: $n $url")
+    get_page(url); () 
+  }
   else {
     println(s"Visiting: $n $url")
     for (u <- get_all_URLs(get_page(url))) crawl(u, n - 1)
@@ -34,6 +37,6 @@
 val startURL = """http://www.inf.kcl.ac.uk/staff/urbanc/"""
 
 // can now deal with depth 3 and beyond
-crawl(startURL, 4)
+crawl(startURL, 3)