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.
IndexProgramming Questions & HelpSyntax Questions › cURL / Processing / Twitter
Page Index Toggle Pages: 1
cURL / Processing / Twitter (Read 1500 times)
cURL / Processing / Twitter
Apr 23rd, 2009, 2:08pm
 
Hello everyone

first post here.

Im currently working on a project for my master degree at University of Aveiro (Portugal) and I could use some help since its my first time coding processing.

My app should get the RSS feed from twitter and print a line, whenever a new tweet is sent.
At the moment everything is working fine but im checking my own tweets, and only the ones that come from my user. I can get a XML file using cURL with all the tweets from my friends (wich is exactly what i need).

Code:
Get updates from users you follow in XML, authenticated: curl -u username:password hxxp://twitter.com/statuses/friends_timeline.xml 




My question is, how can Processing interact with cURL so I can authenticate and get that same result.
as long as it works its ok, doesnt really need to be cURL. I need to authenticate before i get that friends_timeline.xml

After authenticating, i can get teh friends_timeline.rss and apply it on my existing processing code.





heres my processing code so far (its speaking to arduino):
Code:

import simpleML.*;
import processing.serial.*;
XMLRequest xmlRequest;
int time;
String lasttweet;
int i;
String[] check;
String[] titulo;

Serial port;

void setup() {
println("starting....");
frameRate(1);
//xmlRequest = new XMLRequest(this,"hxxp://twitter.com/statuses/friends_timeline.rss");
xmlRequest = new XMLRequest(this,"hxxp://twitter.com/statuses/user_timeline/23058764.rss");
int time = 0;
lasttweet=" ";
port = new Serial(this, Serial.list()[1], 9600);
}

void draw() {
background(0);
time++;
if (time>=4){
xmlRequest.makeRequest();
time=0;
}
}

void netEvent(XMLRequest ml) {
println("\n\nRequesting Info...\n");
titulo = ml.getElementArray("title");
check = match(titulo[1], lasttweet);
if (check != null){
println("New Tweet");
port.write('H');
}
else{
println("No Activity \n");
port.write('L');
}
println("Tweet Anterior: " + lasttweet + "\nTweet Novo: " + titulo[1]);
lasttweet = titulo[1];
}

Re: cURL / Processing / Twitter
Reply #1 - Apr 23rd, 2009, 2:42pm
 
I don't use Twitter, but I saw lot of messages in this forum about this site. A quick search should reveal lot of solutions... Smiley
Re: cURL / Processing / Twitter
Reply #2 - Apr 23rd, 2009, 2:53pm
 
i need a specific detail about processing and curl.
How can i make processing execute a curl command?

or

how can i authenticate to twitter using processing.
Re: cURL / Processing / Twitter
Reply #3 - Apr 24th, 2009, 4:59am
 
Anyone?  Embarrassed
Re: cURL / Processing / Twitter
Reply #4 - Apr 24th, 2009, 1:25pm
 
you can run external commands in java using Process / Runtime / exec.

http://java.sun.com/developer/JDCTechTips/2003/tt0304.html
Re: cURL / Processing / Twitter
Reply #5 - Apr 24th, 2009, 1:35pm
 
but a quick search brings up Twitter4j which uses the twitter api directly - much neater.

http://yusuke.homeip.net/twitter4j/en/index.html
Re: cURL / Processing / Twitter
Reply #6 - Apr 25th, 2009, 1:09am
 
koogy wrote on Apr 24th, 2009, 1:25pm:
you can run external commands in java using Process / Runtime / exec.
Processing has open() to wrap this neatly. But using cURL for something Java can do natively is a bit messy (and not portable).

And I already answered, I don't see the point of duplicating the numerous threads talking about Twitter in this forum. They should get him started.
Re: cURL / Processing / Twitter
Reply #7 - Apr 27th, 2009, 7:17am
 
im not familiar with Java and we're using Processing to code our software and make Arduino to interact with it.

I found Twitter4j long before but i wasnt sure if processing could handle it, and i didnt really know how to work with it.
I have basic knowledge  coding wise so its a bit harder for me to understand this kind of stuff  Embarrassed

Philho i did a search on the forum before posting and i only saw 1 thread about twitter and it didnt really help me, but i'll give it another shot.


Any chance of explaining the Process / Runtime / Exec. thingy a bit better?  Smiley

Re: cURL / Processing / Twitter
Reply #8 - Apr 27th, 2009, 8:12am
 
Sgt.Oneill wrote on Apr 27th, 2009, 7:17am:
i did a search on the forum before posting and i only saw 1 thread about twitter and it didnt really help me, but i'll give it another shot.

The new integrated search is a bit tricky now... You have to select (all posts) in the This post was made in the last... field, and check the Display only one result per thread checkbox otherwise we see mostly this thread...
With these settings, I see more than half a dozen of related threads, including a number using Twitter4J, some related with Arduino, etc.
Re: cURL / Processing / Twitter
Reply #9 - Apr 27th, 2009, 9:00am
 
Quote:
Any chance of explaining the Process / Runtime / Exec. thingy a bit better?  Smiley


it's standard java, there are examples all over the web. BUT i still recommend using Twitter4J. the clue is in the name...
Re: cURL / Processing / Twitter
Reply #10 - Apr 27th, 2009, 9:29am
 
Thanks Phillho you were right about the search  Grin

Ill update this soon when i get my hands on the job.
Thank u
Re: cURL / Processing / Twitter
Reply #11 - Apr 27th, 2009, 1:58pm
 
No problem, I can't help much technically here, but you know the proverb about teaching to fish instead of giving fishes... Wink
Page Index Toggle Pages: 1