Souce.fromURLで
import scala.io.Source
object Main {
def main(args : Array[String]) : Unit = {
println(
Source.fromURL("http://blog.kzfmix.com/","utf8")
.getLines
.mkString
)
}
}
proxyの指定は
import scala.io.Source
object Main {
def main(args : Array[String]) : Unit = {
System.setProperty("http.proxyHost","proxy.co.jp")
System.setProperty("http.proxyPort","8080")
println(
Source.fromURL("http://blog.kzfmix.com/","utf8")
.getLines
.mkString
)
}
}
参考 - scala.io.Sourceとscala.xml.parsing.XhtmlParserCommentsAdd Star