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).

!7

static AsyncTwitter asyncTwitter;
static new Set<Long> seen;
  
p-exp {
  Twitter twitter = twitter4j_init();
  
  asyncTwitter = new AsyncTwitterFactory().getInstance(twitter);
  asyncTwitter.addListener(new TwitterAdapter {
    public void searched(QueryResult qr) {
      //printWithMS("RESULT");
      L<Status> tweets = qr.getTweets();
      new Set<Long> seen2;
      //pnlIndent("Tweet ", tweets);
      bool first = true;
      for (Status t : tweets) {
        long id = t.getId();
        seen2.add(id);
        continue if seen.contains(id);
        if (first) { first = false; printWithMS("NEW TWEETS"); }
        
        User usr = t.getUser();
        print("  " + localDateWithMilliseconds(t.getCreatedAt()) + " " + id + " " + (usr == null ? "none" : "@" + usr.getScreenName() + " // " + usr.getName()) + ": " + escapeNewLines(t.getText()));
      }
      seen = seen2;
    }
  });
  
  repeat with sleep 5 {
    //printWithMS("Searching");
    asyncTwitter.search(new Query("#javascript"));
    //printWithMS("Searched");
  }
}

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: 398 / 1207
Version history: 20 change(s)
Referenced in: [show references]