Skip to content

Instantly share code, notes, and snippets.

@cocodrino
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocodrino/1b5b4d762899b90dcbc0 to your computer and use it in GitHub Desktop.
Save cocodrino/1b5b4d762899b90dcbc0 to your computer and use it in GitHub Desktop.
YQL from scala
import scalaj.http.{HttpOptions, Http}
def YQL3(query: String) = {
val url = "http://query.yahooapis.com/v1/public/yql"
Future {
blocking {
Http(url).params("format" -> "xml", "q" -> query)
.option(HttpOptions.connTimeout(5000)) //Optional: yql can take a long time for response
.option(HttpOptions.readTimeout(10000)).asString
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment