author | Christian Urban <urbanc@in.tum.de> |
Wed, 10 Oct 2012 08:39:24 +0100 | |
changeset 26 | 06be91bbb1cd |
parent 13 | 6d554a18b81e |
permissions | -rw-r--r-- |
7 | 1 |
val http_pattern = """\"https?://[^\"]*\"""".r |
2 |
val my_urls = """urbanc""".r |
|
3 |
val email_pattern = |
|
4 |
"""([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})""".r |
|
5 |
||
6 |
def crawl(url: String, n: Int) : Unit = { |
|
7 |
if (n == 0) () |
|
8 |
else { |
|
9 |
println("Visiting: " + n + " " + url) |
|
10 |
val page = get_page(url) |
|
11 |
println(email_pattern.findAllIn(page).mkString("\n")) |
|
12 |
for (u <- get_all_URLs(page)) crawl(u, n - 1) |
|
13 |
} |
|
14 |
} |