// Simple twitter search demo - November 2011 - rtwomey@u.washington.edu // // twitter search options: // https://dev.twitter.com/docs/api/1/get/search // // twitter API documentation. We are using the REST API: // https://dev.twitter.com/docs // void setup() { size(200, 200); background(50); fill(200); String baseURL = "http://search.twitter.com/search.atom?"; // address for twitter search String tagString="Turkey"; // search string String query = baseURL+"q="+tagString; // do actual query call XMLElement xml = new XMLElement(this, query); // holds the results println(xml); // gather results XMLElement[] tweets = xml.getChildren("entry"); // get tweets //println(tweets); //println(tweets.length + " tweets"); //loop over results for (int i = 0; i < tweets.length; i++) { String title = tweets[i].getChild("title").getContent(); String content = tweets[i].getChild("content").getContent(); String updated = tweets[i].getChild("updated").getContent(); String author_name = tweets[i].getChild("author/name").getContent(); // display me! // println(title+" : "+content); //println(title); //println(author_name); println(updated+" : "+author_name); // or process me with regular expressions // or string operations // or draw me to screen. store me for later. } } void draw() { }