Sahil Sharma
Sahil Sharma

Reputation: 4217

How convert html or URL output of Scala to JSON

val url = "http://api.hostip.info/get_json.php?ip=12.215.42.19"
val result = scala.io.Source.fromURL(url).mkString
println(result)

This gives me the complete HTML page. I want to access individual html elements of this web-page now to do some data analysis. In C# we did it using DYNAMIC variable and then putting html data into some class (json object).

How can we format this URL result to some classes for analysis?

Problem is to download HTML URL page, access its individual elements through Scala code.

Upvotes: 1

Views: 578

Answers (1)

Chobeat
Chobeat

Reputation: 3535

Give a look to scala-scraper: https://github.com/ruippeixotog/scala-scraper

Upvotes: 1

Related Questions