Simple periodic tweet collector.
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
config
lib
test
.gitignore
LICENSE
README.md
package.json

README.md

Tweet Collector

Simple periodic tweet collector.

npm install --save tweet-collector
var TweetCollector = require('tweet-collector');
var tweetCollector = new TweetCollector(twitterCredentials, {
  batch_size: 100,
  interval: 10, // seconds
  search_params: {
    q: 'comma,separated,keywords'
  }
});
tweetCollector.start();
tweetCollector.on('fetch', function(tweetsArray) {
  console.log(tweetsArray);
});

API

TweetCollector(twitterCredentials, settings)

Instantiate a TweetCollector.

Example:

var tweetCollector = new TweetCollector(twitterCredentials, settings);

search_params

See Twitter API Docs.

tweetCollector.start(searchParams)

Starts tweet collector instance.

tweetCollector.stop()

Stops tweet collector instance.

tweetCollector.on('fetch', onTweetFetch)

tweetCollector.on('fetch', function onTweetFetch(tweetsArray) {
  console.log(tweetsArray);
});

CLI

$ npm install -g tweet-collector
$ tweet-collector -h

  Usage: tweetcollector [options]

  Options:

    -h, --help                output usage information
    -t --twittercfg <path>    twitter credetinals configuration file
    -k --keywords "<string>"  comma separated keywords to search
    -b --batch-size <number>  twitter search batch size
    -i --interval <number>    twitter search interval window in seconds

$ tweet-collector -t path/to/cfg.json -k "comma,separated,keywords" -b 50 -i 60

See config/twitter.json for Twitter credentials configuration.

Handling multiple collector instances

See tweet-collector-supervisor package.