We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
twitter4j (Read 1034 times)
twitter4j
Jun 23rd, 2009, 12:37am
 
Hello. I'm trying to do some experiments with data derived from twitter search queries. I found the following code that works but needs to be translated into processing. I've spent a couple hours looking at it with no luck (my hacking has its limits). Can anyone help me?  My goal is to extract the text containing the associated search from each list entry and drop everything else. Any help would be much appreciated!!!  Cheesy

   Twitter twitter = new Twitter();
   Query query = new Query("source:twitter4j thinking");
   QueryResult result = twitter.search(query);
   System.out.println("hits:" + result.getTotal());
   for (Tweet tweet : result.getTweets()) {
       System.out.println(tweet.getFromUser() + ":" + tweet.getText());
   }

Re: twitter4j
Reply #1 - Jun 24th, 2009, 1:01am
 
Hi,

The for-loop expression you are using is not applicable to Processing and JDK1.4.2 environment.


-------------
 Twitter twitter = new Twitter();
  Query query = new Query("source:twitter4j thinking");
  QueryResult result = twitter.search(query);
  // getTotal() method is deprecated and doesn't return meaningful value anymore
  System.out.println("hits:" + result.getTotal());
  List tweets = result.getTweets();
  for(int i=0; i < tweets.size(); i++){
      Tweet tweet = (Tweet)tweets.get(i);
      System.out.println(tweet.getFromUser() + ":" + tweet.getText());
  }
-------------

Cheers,
Yusuke
Page Index Toggle Pages: 1