diff -r cbc2270c2938 -r 4758a6155878 progs/crawler2.scala --- a/progs/crawler2.scala Thu Sep 26 10:36:24 2013 +0100 +++ b/progs/crawler2.scala Thu Sep 26 10:39:23 2013 +0100 @@ -5,7 +5,7 @@ import scala.util.matching.Regex import scala.util._ -// gets the first ~10K of a page +// gets the first ~10K of a web-page def get_page(url: String) : String = { Try(Source.fromURL(url).take(10000).mkString) getOrElse { println(s" Problem with: $url"); ""} @@ -28,7 +28,7 @@ // visits pages potentially more than once def crawl(url: String, n: Int) : Unit = { if (n == 0) () - //else if (my_urls.findFirstIn(url) == None) () + else if (my_urls.findFirstIn(url) == None) () else { println(s"Visiting: $n $url") for (u <- get_all_URLs(get_page(url))) crawl(u, n - 1)