Class:TwitterWrapper
Object:A twitter feed reader and updater based on the twitter4j libraries from: http://twitter4j.org.
Methods or Operations:
String[] getFeed() - returns most recent tweets in your feed.
void setStatus(String s) - updates current status
Declaration and initialization:
TwitterWrapper twitter = new TwitterWrapper("[public key]","[private key]");NOTE: You must replace the strings "[public key]" and "[private key]" with the correct public and private key for the CSC103 Twitter App. I have posted this information in the Assignments section of eLearn for the course. I can't put this information out on the web unfortunately. Example:
public static void main(String[] args) { TwitterWrapper twitter = new TwitterWrapper("[public key]","[private key]"); // <--- REPLACE WITH CORRECT KEYS FROM ELEARN // Get and display tweets: String[] tweets = twitter.getTweets(); System.out.println("--- Twitter Feed ---"); for (int i=0; i<tweets.length; i++) { System.out.println(tweets[i]); } // Set status twitter.setStatus("Computer Science rocks..."); }
This will get and display most recent tweets and update your twitter status.
NOTE: As part of running this program you have to authenticate with Twitter:
NOTE: You must make Dr. Java aware of the twitter4j libraries that are included with the TwitterWrapper class.
Open the following URL and grant access to your account: https://api.twitter.com/oauth/authorize?oauth_token=9njjmGxopV2O4v59IjFd1DpdlsXaR232BnTf2lrax8g <--- Copy & Paste to browser Enter the PIN(if aviailable) or just hit enter.[PIN]: 55332211 <--- Copy & Paste from browser --- Twitter Feed --- drbobdugan:Final testing for CSC103 Twitter App TEDTalks Updates:Today's #TED: ecologist Lian Pin Koh uses drones to track wild animals, monitor rainforests, even combat crime: http://t.co/pw7zFvIcy3 Little,Big:RT @nakedhighway: Photo: Chuck & his #moustache! #movember #plusheartstar #tbone #brooklyn #indie #music @littlecommabig http://t.co/89bUxf… The Daily Show:This week: Jon welcomes actress Elizabeth Olsen, the legendary @BillCosby, Jennifer Lawrence, and Tom Brokaw. 11/10c. http://t.co/QZO5HiXPC7 drbobdugan:test with authentication drbobdugan:test The Daily Show:Academy Award-winning actor Geoffrey Rush discusses the challenges of filming a Nazi movie in Germany. http://t.co/z3zE47CLKt echofon:Want a FREE iPhone app for a superb photo viewing experience? Download @Echofon 's sister app, Photofon HD: http://t.co/VXgkYxe77b The Daily Show:This week: Jon welcomes actress Elizabeth Olsen, the legendary @BillCosby, Jennifer Lawrence, and @tombrokaw. 11/10c. #DailyShow The Daily Show:60 Minutes: Meh Culpa http://t.co/Z97sw2RI9N The Daily Show:Assume the Physician http://t.co/yMXnn3dk7P #DailyShow Little,Big:RT @License_Farm: The long-awaited return of @littlecommabig! Opening act for @markschaffer the Darklord's b'day & CD release! 11/15/13 htt… The Daily Show:#TDSBreakingNews Toronto mayor Rob Ford gets a TV show. Which he will eventually sell for crack. The Daily Show:.@neiltyson, Buzzkill of Science, debunks the science behind zombies. http://t.co/ZWQJdL107W The Daily Show:'Racist or Not Racist?' featuring @msjwilly, @jonesinforjason, @aasif, @KeeganMKey and @JordanPeele. http://t.co/Zh7AzGNEGw Little,Big:Filming the next T-bone Band Extravaganza! #plusheartstar http://t.co/Xa3ls7holT The Daily Show:Embattled crack-smoking Mayor Rob Ford answers questions about his drug history before the Toronto city council. http://t.co/snO4D84hBB The Daily Show:Jon Stewart shares his thoughts on the "above ground marinara swimming pool for rats" that Chicago calls pizza. http://t.co/ufNoq2KSIk The Daily Show:#TDSBreakingNews http://t.co/KyCKxLGCJL contractor posts profit. Meanwhile "justice" quits job, closes shop, goes to live on remote island.