tweetable
v0.0.2
Published
Readable streams for Twitter streaming API's.
Downloads
3
Readme
Tweetable
Readable streams of tweets from Twitter's public stream API's.
Tweets + Readable = Tweetable.
Very alpha at the moment.
Usage
Arguments
api
: API credentials from Twitter. Object withkey
andsecret
properties.access
: Access credentials from Twitter (unique to the user the request is being made for). Object withtoken
andsecret
properties.method
: Twitter public streams method. Currently must beuser
,filter
,sample
orfirehose
(if you have access, which you probably don't).params
: Params for filter streams or user streams. Do not use with sample or firehose streams.
Returns a readable stream that emits an object for each Tweet (not strings or buffers, like most Node streams).
var tweetable = require('tweetable')
var api = {
key: 'twitter app API key',
secret: 'twitter app API secret'
}
var access = {
token: 'twitter user access token',
secret: 'twitter user access secret'
}
tweetable(api, access, 'filter', {track: 'california'}).on('data', function (tweet) {
var localCreatedAt = new Date(Date.parse(tweet.created_at))
console.log('%s: %s', localCreatedAt, tweet.text)
}).on('error', function (err) {
console.error(err, err.stack)
process.exit(1)
})