changeset 93 | 4794759139ea |
parent 92 | e85600529ca5 |
child 96 | 9fcd3de53c06 |
92:e85600529ca5 | 93:4794759139ea |
---|---|
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 } |