-
Notifications
You must be signed in to change notification settings - Fork 1
/
twitterConfig.pde
37 lines (33 loc) · 1.51 KB
/
twitterConfig.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// Config twitter stream setup here ////////////////////////////
//// create twitterStream object
TwitterStream twitterStream = new TwitterStreamFactory().getInstance();
//// create twitterTweet object
Twitter twitterTweet = new TwitterFactory().getInstance();
//// create twitterSearch object
Twitter twitterSearch = new TwitterFactory().getInstance();
//// define access codes
static String OAuthConsumerKey = "";
static String OAuthConsumerSecret = "";
static String AccessToken = "";
static String AccessTokenSecret = "";
///////////////////////////// End twitter config ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
void connectTwitter() {
AccessToken accessToken = loadAccessToken();
//connect twitterStream
twitterStream.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);
twitterStream.setOAuthAccessToken(accessToken);
println("stream connected");
////connect twitterTweet
twitterTweet.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);
twitterTweet.setOAuthAccessToken(accessToken);
println("tweet connected");
twitterSearch.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);
twitterSearch.setOAuthAccessToken(accessToken);
println("search connected");
}
// Loading up the access token
private static AccessToken loadAccessToken() {
return new AccessToken(AccessToken, AccessTokenSecret);
}