Skip to content

Instantly share code, notes, and snippets.

@DannyDelott
Created February 14, 2015 23:53
Show Gist options
  • Save DannyDelott/9c9fa16cf854cbea4024 to your computer and use it in GitHub Desktop.
Save DannyDelott/9c9fa16cf854cbea4024 to your computer and use it in GitHub Desktop.
Begin scraping Vine Videos
// instantiates buffers
buffer1 = new TweetBuffer(1, SAVE_DIRECTORY);
buffer2 = new TweetBuffer(2, SAVE_DIRECTORY);
currentBufferId = 1;
duplicateUrls = new HashSet < String > ();
// instantiates listener to fill and process the buffers
StatusListener listener = new StatusListener() {
@Override
public void onStatus(Status status) {
if ((currentBufferId == 1) && !buffer1.isProcessing()) {
buffer1.addStatus(status);
return;
}
if ((currentBufferId == 2) && !buffer2.isProcessing()) {
buffer2.addStatus(status);
return;
}
}
@Override
public void onTrackLimitationNotice(int numLimitedStatuses) {
processCurrentBuffer(); // see Step 4
}
});
// starts scraping Vine videos
twitter.addListener(listener);
twitter.filter(fq);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment