Skip to content

Instantly share code, notes, and snippets.

@sebastienblanc
Created June 2, 2011 19:21
Show Gist options
  • Save sebastienblanc/1005096 to your computer and use it in GitHub Desktop.
Save sebastienblanc/1005096 to your computer and use it in GitHub Desktop.
Basic Twitter search DSL
import groovyx.net.http.*
@Grab(group='org.codehaus.groovy.modules.http-builder',
module='http-builder', version='0.5.1' )
def http = new HTTPBuilder( 'http://search.twitter.com/' )
def tweets = 'tweets'
def search = {String s -> [about: {String s2 ->
http.get( path: 'search.json',
query: [q:s2, count:5] ) { resp, json ->
json.results.each {
println ' ' + it.text
}
}
}]
}
//search twitter DSL
search tweets about 'groovy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment