--- a/progs/crawler1.scala Fri Sep 27 11:01:31 2013 +0100
+++ b/progs/crawler1.scala Fri Sep 27 11:49:44 2013 +0100
@@ -5,7 +5,7 @@
import scala.util.matching.Regex
import scala.util._
-// gets the first ~10K of a web-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"); ""}
@@ -18,7 +18,7 @@
def unquote(s: String) = s.drop(1).dropRight(1)
def get_all_URLs(page: String) : Set[String] = {
- (http_pattern.findAllIn(page)).map { unquote(_) }.toSet
+ http_pattern.findAllIn(page).map(unquote).toSet
}
// naive version - seraches until a given depth
@@ -35,6 +35,5 @@
val startURL = """http://www.inf.kcl.ac.uk/staff/urbanc/"""
//val startURL = """http://www.inf.kcl.ac.uk/staff/mml/"""
-
crawl(startURL, 2)