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 & HelpIntegration › Processing and Twitter
Pages: 1 ... 3 4 5 6 
Processing and Twitter (Read 65235 times)
Re: Processing and Twitter
Reply #60 - Jul 6th, 2009, 4:29pm
 
I'm sill having trouble getting any of these twitter codes to work. Are they only for Mobile Processing?
Re: Processing and Twitter
Reply #61 - Jul 6th, 2009, 5:02pm
 
//Alright! Got this to work:

Twitter twitter;
int friendCount;
User[] friends;
String username = "username"; // add your own here
String password = "password"; // add your own here

java.util.List statuses =null;

twitter = new Twitter(username,password);

try
{
Status status1 = twitter.update("Twitter on Processing");
}
catch( TwitterException e)  {
 println(e.getStatusCode());
}
Re: Processing and Twitter
Reply #62 - Sep 6th, 2009, 11:37am
 
I also get -1 returned, but only after the first result when i run my code in an applet.

Anyone know why that might be? (the .jar files are all signed correctly, i think)

Thanks
Will
Re: Processing and Twitter
Reply #63 - Oct 3rd, 2009, 9:52am
 
hey i want to develop a code which would search specific profiles rather than performing a universal search..i am not even sure if such an option exists..any ideas..i am facing a stiff deadline guys..any help would be really appreciated
Re: Processing and Twitter
Reply #64 - Oct 11th, 2009, 12:38pm
 
hi, i want to get geocodes of the users of twitters and visualize that together with the time codes. I'm a noob at Processing, so please help me. This is what they say at twitter4j:


]getGeocode

public java.lang.String getGeocode()

setGeoCode

public void setGeoCode(double latitude,
                      double longtitude,
                      double radius,
                      java.lang.String unit)

   returns tweets by users located within a given radius of the given latitude/longitude, where the user's location is taken from their Twitter profile

   Parameters:
       latitude - latitude
       longtitude - longtitude
       radius - radius
       unit - Query.MILES or Query.KILOMETERS




i want to intergrate it into this script:

Twitter twitter;
String myTimeline;
User[] friends;
String username = "usr";
String password = "pass";
java.util.List statuses = null;

void setup(){
twitter = new Twitter(username,password);
}



void draw(){

}





// begin tweets
void tweets(){
try
{
statuses = twitter.getPublicTimeline();

}
catch( TwitterException e)
{
println(e.getStatusCode());
}
for( int i=0; i<statuses.size(); i++ )
{
  Status status = (Status)statuses.get(i);
  println(status.getUser().getName() + ":" + status.getText() + ":"  );
}

}
Re: Processing and Twitter
Reply #65 - Oct 13th, 2009, 5:45pm
 
Sgt.Oneill wrote on Apr 29th, 2009, 9:11am:
Goodness Gracious it works... heres the Code
Code:


Twitter twitter;
String myTimeline;
User[] friends;
String username = "USERNAME"; // add your own here
String password = "PASSWORD"; // add your own here
java.util.List statuses = null;

twitter = new Twitter(username,password);
//java.util.List statuses = twitter.getUserTimeline();
try
{
statuses = twitter.getUserTimeline();
}
catch( TwitterException e)
{
println(e.getStatusCode());
}
for( int i=0; i<statuses.size(); i++ )
{
  Status status = (Status)statuses.get(i);
  println(status.getUser().getName() + ":" + status.getText());
}





Result:
A list of all the tweets made by that certain user.






Time to read and understand the code so I can re-do it for my purpose =D

thanks everyone, I shall keep this post updated with news.  Cool


So I took your code and tried playing with it. I'm trying to get it to draw out in an applet, but can't seem to figure out what exactly I need to do this. If you haven't figured it out, I'm new to all of this.
Re: Processing and Twitter
Reply #66 - Oct 16th, 2009, 2:26pm
 
So I was working on it a bit (which is pretty amateur) and I can get my output window to show ONE update from my twitter account, but can't get it to show all of them. Anyone know why?

Code:
Twitter twitter;
String myTimeline;
User[] friends;
String s;
String username = "username"; // add your own here
String password = "password"; // add your own here
java.util.List statuses = null;

void setup() {
size(900, 600);
textFont(createFont("Arial", 12));
colorMode(HSB);


twitter = new Twitter(username,password);
//java.util.List statuses = twitter.getUserTimeline();
try
{
statuses = twitter.getUserTimeline();
}
catch( TwitterException e)
{
println(e.getStatusCode());
}
for( int i=0; i < statuses.size(); i++ )
{
Status status = (Status)statuses.get(i);
s = status.getUser().getName() + ":" + status.getText();

}
}

void draw() {
background(33);

text(s, 15, 30);


}
Re: Processing and Twitter
Reply #67 - Nov 6th, 2009, 5:49am
 
I'm having some problems with what seems like a fairly simple thing. I feel a bit silly about it. I making a little application that searches twitter for the term "democracy". I'm using twitter4j and have managed to put something together that gets the tweets and prints them, but they keep ending up on top of each other and I can't figure out how to space them so that I can see all five tweets (i'm very inexperienced with java and processing). Here is my code, any help would be great:

Code:
Twitter myTwitter;

PFont fontA;

void setup() {

 myTwitter = new Twitter("yourTwitterUserName", "yourTwitterPassword");
{
  size( 400, 400 );

}
 
 try {
   Query query = new Query("democracy");

   query.setRpp(5);

   QueryResult result = myTwitter.search(query);

   ArrayList tweets = (ArrayList) result.getTweets();

   for (int i = 0; i < tweets.size(); i++) {

Tweet t = (Tweet) tweets.get(i);
String user = t.getFromUser();

String msg = t.getText();

Date d = t.getCreatedAt();

println(msg);

fontA = loadFont("AdobeFangsongStd-Regular-48.vlw");
 textAlign(LEFT);
textFont(fontA, 16);
text(msg,10,10,390,390);
   
 

   };
 }

 catch (TwitterException te) {

   println("Couldn't connect: " + te);

 };
};

void draw() {

};


Thanks!

Re: Processing and Twitter
Reply #68 - Nov 7th, 2009, 1:05am
 
Try this:

Code:
Twitter myTwitter;
PFont fontA;
void setup() {
myTwitter = new Twitter("yourTwitterUserName", "yourTwitterPassword");
size( 400, 400 );
background(0);
fontA = loadFont("Calibri-18.vlw");
textAlign(LEFT);
textFont(fontA, 16);

try {
Query query = new Query("democracy");
query.setRpp(5);
QueryResult result = myTwitter.search(query);
ArrayList tweets = (ArrayList) result.getTweets();

for (int i = 0; i < tweets.size(); i++) {
pushMatrix();
translate(0,48*i);
Tweet t = (Tweet) tweets.get(i);
String user = t.getFromUser();
String msg = t.getText();
Date d = t.getCreatedAt();
println(msg);

text(msg,10,10,390,390);
popMatrix();
}
}
catch (TwitterException te) {
println("Couldn't connect: " + te);
}
}

void draw() {
}


Re: Processing and Twitter
Reply #69 - Nov 7th, 2009, 1:49am
 
Woh that's great i just needed this!

Does anyone knows how to use these tweets as subtitles?

Please please please
Re: Processing and Twitter
Reply #70 - Nov 10th, 2009, 1:11pm
 
anyone?
Cry
Re: Processing and Twitter
Reply #71 - Dec 7th, 2009, 5:52pm
 
explodingbarrel wrote on Oct 16th, 2009, 2:26pm:
So I was working on it a bit (which is pretty amateur) and I can get my output window to show ONE update from my twitter account, but can't get it to show all of them. Anyone know why

Code:
Twitter twitter;
String myTimeline;
User[] friends;
String s;
String username = "username"; // add your own here
String password = "password"; // add your own here
java.util.List statuses = null;

void setup() {
  size(900, 600);
textFont(createFont("Arial", 12));
colorMode(HSB);


twitter = new Twitter(username,password);
//java.util.List statuses = twitter.getUserTimeline();
try
{
statuses = twitter.getUserTimeline();
}
catch( TwitterException e)
{
println(e.getStatusCode());
}
for( int i=0; i < statuses.size(); i++ )
{
  Status status = (Status)statuses.get(i);
  s = status.getUser().getName() + ":" + status.getText();
 
}
}

void draw() {
background(33);

text(s, 15, 30);


}


I need the answer too!
Re: Processing and Twitter
Reply #72 - Dec 7th, 2009, 9:32pm
 
hi, if you use the statuses-for-loop in your draw function like in the snippet below, you see the latest 20 tweets:
Code:

void draw() {
 background(33);
 for( int i=0; i < statuses.size(); i++ )
 {
   Status status = (Status)statuses.get(i);
   s = status.getUser().getName() + ":" + status.getText();
   text(s, 15, 30+(20*i));
 }
}

Re: Processing and Twitter
Reply #73 - Dec 14th, 2009, 1:42pm
 
So here's what I'm trying to do, maybe someone can help since I'm hopeless with this stuff and have been poking and prodding and cannot seem to figure out WHAT i need to do.

The idea is to have two vessels, and a nozzle about each, one for positive comments, one for negative comments.

each time someone tweets something positive (with, say, the keyword awesome, great, cool, fantastic) a water drop (or circle) would come out of the possitive nozzle and fall into the first vessle. Something negative (sucks, stupid, awful, horrible) a drop would fall into the second.

So i know IN THEORY what needs to be done: call the API, search for the keyword and everytime it finds a tweet that contains one of the keywords a droplet is drawn (and falls I guess using some sort of gravity).

I just have no clue how to go about doing so... for one thing I'm not even sure how to get it to keep recalling the API, and if that's even possible... I can get it to do a scan and return, say, 20 results but to get it to return a result, try again, return a result, etc. no clue how to do so (if its even possible)
Re: Processing and Twitter
Reply #74 - Dec 30th, 2009, 3:50pm
 
I just posted a library for accessing the Twitter streaming API that makes this quite a bit simpler.  Can't post a direct link here yet, but you you look at twitter.com/mccv you can get the link from my latest tweet.  You should just have to set up the appropriate streaming API URL, and then implement the tweet() method.
Pages: 1 ... 3 4 5 6