/* * Copyright 2008-2011 Wyld Collective / Obx Labs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * DetailedTwitterFeed * * This example shows how to get entries from a detailed Twitter search, * which is returned as a syndicated feed. The sketch sends a search * query to Twitter, prints out its entries to the console, and continues * pulling entries at interval if any are available. */ //romefeeder import com.wyldco.romefeeder.*; import com.sun.syndication.feed.synd.*; TwitterFeeder feeder; // the feeder SyndEntry entry; // a feed entry void setup() { //create the feeder feeder = new TwitterFeeder(this); //turn on output to the console (useful for debugging) feeder.verbose = true; //set sort by published date //default is unsorted (i.e. as ordered in the feed) feeder.sortByPublishedDate(); //if you are exporting your sketch to an applet //set the proxy to bypass applet domain limitations //make sure you copy the proxy.php provided in the //data folder of example SimpleUrlFeed to your applet directory //feeder.setProxy("http://[urlToApplet]/DetailedTwitterFeed/applet/proxy.php"); //set the update interval to check for new posts in the loaded feed(s) feeder.setUpdateInterval(30*1000); // milliseconds //start updating feeder.startUpdate(); //setup and query the search feeder.all("master"); //get tweets with the word master feeder.not("thesis"); //exclude the tweets with the word thesis feeder.lang("en"); //get only tweets in english feeder.question(true); //get tweets that are questions feeder.rpp(50); //get 50 tweets at a time feeder.search(); //set search } void draw() { //display the next entries while (feeder.hasNext()) { //get the next entry entry = feeder.next(); println("\n" + entry.getTitle()); println(" + " + entry.getPublishedDate()); println(" + " + entry.getLink()); } }