Created
September 6, 2011 14:44
-
-
Save ksky/1197737 to your computer and use it in GitHub Desktop.
Twitter4J+GroovyでストリーミングAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.twitter4j:twitter4j:2.2.5') | |
@Grab('org.twitter4j:twitter4j-stream:2.2.5') | |
import twitter4j.* | |
def stream = new TwitterStreamFactory().instance | |
def listener = [ | |
onStatus: { st -> println "$st.user.screenName: $st.text" }, | |
onException: { ex -> ex.printStackTrace() }, | |
] as UserStreamAdapter | |
stream.addListener(listener) | |
stream.user() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OAuth情報書いたtwitter4j.propertiesも必要です