Problems with twitter4j
in
Contributed Library Questions
•
2 years ago
hey been using this code to get twitter4j working but keep getting this error saying unexpected character "\" but this character doesn't exist in the code so i don't really get it.
it also says:
processing.app.debug.
RunnerException: unexpected char: '\'
at processing.app.Sketch.
preprocess(Sketch.java:1352)
at processing.app.Sketch.
preprocess(Sketch.java:1205)
at processing.app.Sketch.build(
Sketch.java:1568)
at processing.app.Sketch.build(
Sketch.java:1553)
at processing.app.Editor$
DefaultRunHandler.run(Editor.
java:1485)
at java.lang.Thread.run(Thread.
java:680)
any help would be much appreciated thank you.
- /*
- Posts a message to a Twitter account when you press the mouse button.
- Uses Twitter4j, http://twitter4j.org.
- For more info: http://tinkerlondon.com/now/2010/09/13/oauth-twitter-and-processing/
- Daniel Soltis, September 2010
- */
- import twitter4j.conf.*;
- import twitter4j.internal.async.*;
- import twitter4j.internal.org.json.*;
- import twitter4j.internal.logging.*;
- import twitter4j.http.*;
- import twitter4j.api.*;
- import twitter4j.util.*;
- import twitter4j.internal.http.*;
- import twitter4j.*;
- String msg = “Automatically posted from Processing”;
- //copy and paste these from your application in dev.twitter.com
- String consumer_key = “publicconsumerkeyfromtwitterdevpage”;
- String consumer_secret = “secretconsumerkeyfromtwitterdevpage”;
- String oauth_token = “accesstokenforyouraccount”;
- String oauth_token_secret = “secretaccesstokenforyouraccount”;
- color bgcolor = color(255);
- long timer;
- void setup() {
- size(640,480);
- }
- void draw() {
- background(bgcolor);
- if (millis()-timer > 2000) bgcolor = color(255);
- }
- void mousePressed() {
- Twitter twitter = new TwitterFactory().getOAuthAuthorizedInstance (
- consumer_key, consumer_secret,
- new AccessToken( oauth_token, oauth_token_secret) );
- try {
- Status st = twitter.updateStatus(msg + ” ” + second());
- println(“Successfully updated the status to [" + st.getText() + "].”);
- bgcolor = color(0,0,255);
- timer = millis();
- }
- catch (TwitterException e) {
- println(e.getStatusCode());
- }
- }
1