/usr/share/fritzing/sketches/core/Fritzing Creator Kit DE+EN/creator-kit-en/Processing/TwitterSaurus2/TwitterSaurus2.pde is in fritzing-data 0.9.2b+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /*
Just a simple Processing and Twitter thingy majiggy
RobotGrrl.com
Code licensed under:
CC-BY
*/
// First step is to register your Twitter application at dev.twitter.com
// Once registered, you will have the info for the OAuth tokens
// You can get the Access token info by clicking on the button on the
// right on your twitter app's page
// Good luck, and have fun!
// This is where you enter your Oauth info
static String OAuthConsumerKey = "uzr17kGYqhgNDjTBNQd1qA";
static String OAuthConsumerSecret = "ZZUfCHruwv4d6Tn9uGz0UGebxfn4oQDikv3NeCbd14";
// This is where you enter your Access Token info
static String AccessToken = "221060254-8MJIyVpXotDhemKaJKVN88L1FlCcndToB8y143LU";
static String AccessTokenSecret = "A2R7IkcSniMnBHYeRK02umHoIvrsHQAdx4NaMq6toY";
// Just some random variables kicking around
String myTimeline;
java.util.List statuses = null;
User[] friends;
TwitterFactory twitterFactory;
//Twitter twitter;
Twitter twitter = TwitterFactory.getSingleton();
RequestToken requestToken;
String[] theSearchTweets = new String[11];
void setup() {
size(100,100);
background(0);
connectTwitter();
//sendTweet("Hey from Simple Processing woop woop #loadedsith #robotgirl");
//getTimeline();
getSearchTweets();
}
void draw() {
background(0);
}
// Initial connection
void connectTwitter() {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setOAuthConsumerKey(OAuthConsumerKey);
cb.setOAuthConsumerSecret( OAuthConsumerSecret );
cb.setOAuthAccessToken( AccessToken);
cb.setOAuthAccessTokenSecret( AccessTokenSecret );
twitterFactory = new TwitterFactory(cb.build());
twitter = twitterFactory.getInstance();
println("connected");
}
// Sending a tweet
void sendTweet(String t) {
try {
Status status = twitter.updateStatus(t);
println("Successfully updated the status to [" + status.getText() + "].");
} catch(TwitterException e) {
println("Send tweet: " + e + " Status code: " + e.getStatusCode());
}
}
// Loading up the access token
private static AccessToken loadAccessToken(){
return new AccessToken(AccessToken, AccessTokenSecret);
}
// Get your tweets
void getTimeline() {
try {
statuses = twitter.getUserTimeline();
} catch(TwitterException e) {
println("Get timeline: " + e + " Status code: " + e.getStatusCode());
}
for(int i=0; i<statuses.size(); i++) {
Status status = (Status)statuses.get(i);
println(status.getUser().getName() + ": " + status.getText());
}
}
// Search for tweets
void getSearchTweets() {
String queryStr = "Fritzing";
try {
//Query query = new Query("source:twitter4j yusukey");
//query.setRpp(10); // Get 10 of the 100 search results
/*QueryResult result = twitter.search(query);
for (Status status : result.getStatus()) {
println("@" + status.getUser().getScreenName() + ":" + status.getText());
*/
Query query = new Query("hi");
QueryResult result = twitter.search(query);
for (Status status : result.getTweets()) {
System.out.println("@" + status.getUser().getScreenName() + ":" + status.getText());
}
} catch (TwitterException e) {
println("Search tweets: " + e);
}
}
|