changeset 7 | 73cf4406b773 |
child 13 | 6d554a18b81e |
6:0da19c346e24 | 7:73cf4406b773 |
---|---|
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 if (my_urls.findFirstIn(url) == None) () |
|
9 else { |
|
10 println("Visiting: " + n + " " + url) |
|
11 val page = get_page(url) |
|
12 println(email_pattern.findAllIn(page).mkString("\n")) |
|
13 for (u <- get_all_URLs(page)) crawl(u, n - 1) |
|
14 } |
|
15 } |