Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1013888 // Test Twitter API [using Twitter4J, OK with password files]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 284K of libraries. Click here for Pure Java version (1032L/8K).

1  
!7
2  
3  
lib 1013889 // twitter4j
4  
5  
import twitter4j.*;
6  
import twitter4j.conf.*;
7  
8  
p {
9  
  ConfigurationBuilder cb = new ConfigurationBuilder();
10  
  cb.setDebugEnabled(true)
11  
    /*.setUser("LuaOS")
12  
    .setPassword(loadSecretJavaXFile("twitter-luaos-pw.txt"))*/
13  
    .setOAuthConsumerKey(botCompany_twitterKey())
14  
    .setOAuthConsumerSecret(print(botCompany_twitterSecret()))
15  
    .setOAuthAccessToken("373454997-rQMAvkXMqiFhOXWDsizjSSsxBvwlu4bHOJqneWmG")
16  
    .setOAuthAccessTokenSecret(trim(loadSecretJavaXFile("twitter-oauth-secret.txt"));
17  
    
18  
  TwitterFactory tf = new TwitterFactory(cb.build());
19  
  Twitter twitter = tf.getInstance();
20  
21  
  //User user = twitter.verifyCredentials();
22  
  L<Status> statuses = twitter.getUserTimeline("xtraa");
23  
  print("Showing home timeline.");
24  
  for (Status status : statuses)
25  
    print(status.getUser().getName() + ":" + status.getText());
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013888
Snippet name: Test Twitter API [using Twitter4J, OK with password files]
Eternal ID of this version: #1013888/16
Text MD5: fe4be10ea3f99caae9feffb30584dfb4
Transpilation MD5: f81bed33e8388ea7f38f98bdd3054161
Author: stefan
Category: javax / networking
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-11 21:22:28
Source code size: 887 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 506 / 1097
Version history: 15 change(s)
Referenced in: [show references]