twitter4J for a noob
in
Contributed Library Questions
•
9 months ago
Hello, i just find a twitter code, that i want to modify to get some user's tweet about the word "archi"... Just one by second... to put the tweet in an other sketch, in a new class to draw it on a special code that i build.
i think the function is PrentSearch() no?
At first that was not working so i'm searching for a simple code that i can use, i'm really lost (i'm an architecture student, and ihave no help in my school, be king please :( )
... but i don't know, i open it, put the librairy on it and, it tell me that one of the fonction is not working:
Thanks to all the people who can help me!
i think the function is PrentSearch() no?
At first that was not working so i'm searching for a simple code that i can use, i'm really lost (i'm an architecture student, and ihave no help in my school, be king please :( )
... but i don't know, i open it, put the librairy on it and, it tell me that one of the fonction is not working:
Thanks to all the people who can help me!
- import twitter4j.conf.*;
- import twitter4j.internal.org.json.*;
- import twitter4j.internal.logging.*;
- import twitter4j.json.*;
- import twitter4j.internal.util.*;
- import twitter4j.auth.*;
- import twitter4j.api.*;
- import twitter4j.util.*;
- import twitter4j.internal.http.*;
- import twitter4j.*;
- import twitter4j.internal.json.*;
- String msg = "Automatically posted from Processing";
- //copy and paste these from your application in dev.twitter.com
- String consumerKey = "xxx";
- String consumerSecret = "xxx";
- String accessToken = "xxx";
- String accessSecret = "xxx";
- AccessToken token;
- Twitter myTwitter;
- void setup(){
- myTwitter = new TwitterFactory().getInstance();
- myTwitter.setOAuthConsumer(consumerKey, consumerSecret);
- token = new AccessToken(accessToken, accessSecret);
- myTwitter.setOAuthAccessToken(token);
- //
- frameRate(30);
- }
- void draw(){
- try{
- //hashtag
- Query queryHash = new Query("#ensav");
- queryHash.setRpp(1);
- QueryResult resultHash = myTwitter.search(queryHash);
- ArrayList tweetHash = (ArrayList) resultHash.getTweets();
- //get latest post
- Tweet tHash = (Tweet) tweetHash.get(0);
- String msgHash = tHash.getText();
- //println(msgHash);
- println(frameRate); //println(tweets.size());
- //}
- }
- catch(TwitterException te){
- println("couldn't connect: " +te);
- }
- }
1