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.
IndexProcessing DevelopmentLibraries,  Tool Development › Twitter Streaming API Library
Page Index Toggle Pages: 1
Twitter Streaming API Library (Read 9641 times)
Twitter Streaming API Library
Dec 30th, 2009, 3:50pm
 
If anybody is interested, I threw together a library that allows accessing the Twitter streaming API via processing.  You can check it out here mccv.github.com/processing-tweet-stream/.  It's written in Scala, so it's a bit heavier than most libraries, but is (I think) a pretty robust, simple interface to the streaming API.  Comments/critique most welcome.
Re: Twitter Streaming API Library
Reply #1 - Dec 30th, 2009, 4:03pm
 
Thats cool. will definitely take a look at it.
Btw, nice project. Is there a better documentation of it?
looks promising.
Re: Twitter Streaming API Library
Reply #2 - Jan 3rd, 2010, 4:34pm
 
That's all there is right now (well, there's code comments).  I'm more than happy to update the doc though... are there areas in particular you'd like to see fleshed out?
Re: Twitter Streaming API Library
Reply #3 - Jan 3rd, 2010, 4:56pm
 
I was actually talking about your project as i really liked it. BUt couldnt find any more information about it. Havent checked out your library yet, if i have any questions regarding your library i will probably come back and ask
Re: Twitter Streaming API Library
Reply #4 - Jan 5th, 2010, 9:13pm
 
Cedric, the code for the project has been posted here github.com/mccv/twitter_geo_vis in case you're interested
Re: Twitter Streaming API Library
Reply #5 - Jan 11th, 2010, 2:52am
 
Hello MCCV,

I am having a bit of trouble while using your library.
I receive the following error when I try to connect:
Code:
onnecting to twitter stream htttp://stream.twitter.com:80/1/statuses/filter.json?locations=-180,-90,180,90
couldn't connect to htttp://stream.twitter.com:80/1/statuses/filter.json?locations=-180,-90,180,90: org.apache.http.conn.HttpHostConnectException: Connection to htytp://stream.twitter.com:80 refused


It appears in your tweetstream and geostream examples. My credentials are correct and I have all files installed...
Hope you can help!  Smiley

On a separate question: What streams can I follow? I've seen
1/statuses/filter.json?locations=-180,-90,180,90
and
1/statuses/sample.json

My goal is to get a live stream of tweets including a specific keyword. What stream do I use? I have read some of the API Wiki but it's a bit over my head.

My code:
Code:
import com.twitter.processing.*;

// this stores how many tweets we've gotten
int tweets = 0;
// and this stores the text of the last tweet
String tweetText = "";

void setup() {
 size(800,100);
 // set up fonts
 PFont font = loadFont("CharcoalCY-24.vlw");
 textFont(font, 24);
 // set up twitter stream object
 TweetStream s = new TweetStream(this, "stream.twitter.com", 80, "1/statuses/filter.json", "***", "***");
 s.go();
}

void draw() {
 background(0);
 fill(255, 0, 0);
 // draw a box as many pixels wide as the number of tweets we've seen
 rect(20, 20, tweets, 20);
 // and draw the text of the last tweet
 text(tweetText, 10, 70);
}

// called by twitter stream whenever a new tweet comes in
void tweet(Status tweet) {
 // print a message to the console just for giggles if you like
 // println("got tweet " + tweet.id());

 // store the latest tweet text
 tweetText = tweet.text();
 // bump our tweet count by one
 tweets += 1;
}


Re: Twitter Streaming API Library
Reply #6 - Jan 21st, 2010, 8:47pm
 
Hi,

Great library!
I'm wondering if you could give us a concrete example on how to use statuses/filter?

Where and how to I set up my tracking list?

Thanks!
Re: Twitter Streaming API Library
Reply #7 - Jan 21st, 2010, 9:39pm
 
Mark suggested to check this out
github.com/mccv/twitter_geo_vis

very helpfull!!

here's an example of how to use filter:

Code:
 TweetStream s = new TweetStream(this, "stream.twitter.com", 80, "1/statuses/filter.json?track=design", "user", "pass") 

;
Re: Twitter Streaming API Library
Reply #8 - Jun 1st, 2010, 3:43pm
 
Hi!

Sometimes I get an unexpected exception in read loop and the stream is disconnected.

I am wondering if there is a posibility to reconnect.

And, furthermore, is it possible to detect a disconnection? Maybe something like this: if(!stream.isConnected()) ...

I couldn`t find out a solution in the Tweet Stream docs, so I would be glad about any hints!
Re: Twitter Streaming API Library
Reply #9 - Jun 6th, 2010, 11:48am
 
is there a way to run two streams at once?
Re: Twitter Streaming API Library
Reply #10 - Jun 14th, 2010, 6:26am
 
Hey! Thanks for sharing a great library!

Do you know why I am getting delay responses from twitter if it does not recieve any data. I am looking to use this project to show a certain #tag every time one is posted, which in some cases isn't so often!

How can I make it refresh every second without this delay?

Thanks
poly
Page Index Toggle Pages: 1