finish scala
This commit is contained in:
parent
683e77dd4f
commit
fd69c6e68c
@ -1,9 +1,19 @@
|
|||||||
|
// 2023 syntax of scala is too different to reproduce this example
|
||||||
|
|
||||||
import scala.io._
|
import scala.io._
|
||||||
import scala.actors._
|
import scala.actors._
|
||||||
import Actor._
|
import Actor._
|
||||||
|
|
||||||
object PageLoader {
|
object PageLoader {
|
||||||
def getPageSize(url: String) = Source.fromURL(url).mkString.length
|
def getPageSize(url: String) = Source.fromURL(url).mkString.length
|
||||||
|
|
||||||
|
def getCountOfLinks(url: String): int = {
|
||||||
|
val raw = Source.fromURL(url).mkString
|
||||||
|
|
||||||
|
val count = "<a>".r.findAllIn(raw).length
|
||||||
|
|
||||||
|
return count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val urls = List("https://www.amazon.com/",
|
val urls = List("https://www.amazon.com/",
|
||||||
|
Loading…
Reference in New Issue
Block a user