Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viniciusbo/tweet-collector
Simple periodic tweet collector.
https://github.com/viniciusbo/tweet-collector
collector nodejs twitter twitter-api
Last synced: about 2 months ago
JSON representation
Simple periodic tweet collector.
- Host: GitHub
- URL: https://github.com/viniciusbo/tweet-collector
- Owner: viniciusbo
- License: gpl-2.0
- Created: 2014-09-24T00:04:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-05T19:37:38.000Z (over 7 years ago)
- Last Synced: 2024-10-30T00:26:53.303Z (3 months ago)
- Topics: collector, nodejs, twitter, twitter-api
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tweet Collector
Simple periodic tweet collector.
```bash
npm install --save tweet-collector
``````javascript
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:
```javascript
var tweetCollector = new TweetCollector(twitterCredentials, settings);
```
**search_params**See [Twitter API Docs](https://dev.twitter.com/rest/reference/get/search/tweets).
### `tweetCollector.start(searchParams)`
Starts tweet collector instance.
### `tweetCollector.stop()`
Stops tweet collector instance.
### `tweetCollector.on('fetch', onTweetFetch)`
```javascript
tweetCollector.on('fetch', function onTweetFetch(tweetsArray) {
console.log(tweetsArray);
});
```## CLI
```bash
$ npm install -g tweet-collector
$ tweet-collector -hUsage: tweetcollector [options]
Options:
-h, --help output usage information
-t --twittercfg twitter credetinals configuration file
-k --keywords "" comma separated keywords to search
-b --batch-size twitter search batch size
-i --interval 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](https://github.com/viniciusbo/tweet-collector-supervisor) package.