Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created March 28, 2010 18:28
Show Gist options
  • Save kellyrob99/346942 to your computer and use it in GitHub Desktop.
Save kellyrob99/346942 to your computer and use it in GitHub Desktop.
Groovy script for grabbing last 20 Tweets in your home timeline.
@Grab(group='net.homeip.yusuke', module='twitter4j', version='2.0.10')
import twitter4j.Twitter
def getHomeTimeline() {
Console cons = System.console()
def getUsername = { cons.readLine( 'Enter a username: ' ).trim() }
def getPassword = { cons.readPassword( "Enter a password: ").toString()}
def twitter = new Twitter(getUsername(),getPassword())
def response = twitter.getHomeTimeline()
response.each {status ->println "${status.text} FROM ${status.user.name} and SOURCE ${status.source}"; println ""}
}
getHomeTimeline()
println "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment