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

35
LINES

< > BotCompany Repo | #1023426 // Test Ongoing Twitter Search [Poll Version]

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

Download Jar. Uses 0K of libraries. Click here for Pure Java version (6699L/47K).

1  
!7
2  
3  
static AsyncTwitter asyncTwitter;
4  
static new Set<Long> seen;
5  
  
6  
p-exp {
7  
  Twitter twitter = twitter4j_init();
8  
  
9  
  asyncTwitter = new AsyncTwitterFactory().getInstance(twitter);
10  
  asyncTwitter.addListener(new TwitterAdapter {
11  
    public void searched(QueryResult qr) {
12  
      //printWithMS("RESULT");
13  
      L<Status> tweets = qr.getTweets();
14  
      new Set<Long> seen2;
15  
      //pnlIndent("Tweet ", tweets);
16  
      bool first = true;
17  
      for (Status t : tweets) {
18  
        long id = t.getId();
19  
        seen2.add(id);
20  
        continue if seen.contains(id);
21  
        if (first) { first = false; printWithMS("NEW TWEETS"); }
22  
        
23  
        User usr = t.getUser();
24  
        print("  " + localDateWithMilliseconds(t.getCreatedAt()) + " " + id + " " + (usr == null ? "none" : "@" + usr.getScreenName() + " // " + usr.getName()) + ": " + escapeNewLines(t.getText()));
25  
      }
26  
      seen = seen2;
27  
    }
28  
  });
29  
  
30  
  repeat with sleep 5 {
31  
    //printWithMS("Searching");
32  
    asyncTwitter.search(new Query("#javascript"));
33  
    //printWithMS("Searched");
34  
  }
35  
}

Author comment

Began life as a copy of #1013894

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023426
Snippet name: Test Ongoing Twitter Search [Poll Version]
Eternal ID of this version: #1023426/21
Text MD5: 02bc717c70d29fdb7ff55950b5821b95
Transpilation MD5: 9d2cc5ec99a0d1af80a8e654efdd8b02
Author: stefan
Category: javax / networking
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-20 04:54:44
Source code size: 1082 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 400 / 1210
Version history: 20 change(s)
Referenced in: [show references]