Skip to content

Instantly share code, notes, and snippets.

Created January 12, 2011 07:35
Show Gist options
  • Save anonymous/775816 to your computer and use it in GitHub Desktop.
Save anonymous/775816 to your computer and use it in GitHub Desktop.
(import '(twitter4j Query
QueryResult
Tweet
Twitter
TwitterException
TwitterFactory)
'(twitter4j.http AccessToken
RequestToken)
'(java.util List
Properties))
(defn search-tweet [query]
(let [twitter (.getInstance (TwitterFactory.))]
(try
(def result (. twitter search (Query. query)))
(for [tweet (.getTweets result)]
(println "@" (.getFromUser tweet) " - " (.getText tweet)))
(catch TwitterException te (println "Failed to search tweets: " (.getMessage te))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment