Skip to content

Instantly share code, notes, and snippets.

@kylecorry31
Created January 7, 2015 23:46
Show Gist options
  • Save kylecorry31/ae0f856837229f8a971d to your computer and use it in GitHub Desktop.
Save kylecorry31/ae0f856837229f8a971d to your computer and use it in GitHub Desktop.
import scala.io._
import scala.xml._
def getWeatherInfo(id: String) = {
val url = "http://weather.yahooapis.com/forecastrss?w=" + id + "&u=f"
val response = io.Source.fromURL(url).mkString
var xmlResponse = XML.loadString(response)
println(xmlResponse \\ "location" \\ "@city", xmlResponse \\ "condition" \\ "@temp", xmlResponse \\ "condition" \\ "@text")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment