updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 27 Sep 2013 15:43:25 +0100
changeset 116 010ae7288327
parent 115 86c1c049eb3e
child 117 25999de692b2
updated
progs/crawler2.scala
--- 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)