1.0.4 • Published 8 years ago
twitter-crawler v1.0.4
NodeJS Twitter Crawler
Crawl twitter users and user tweets but using multiple credentials. Credentials used in a round-robin mode.
Using the component
NodeJS Twitter Crawler is implemented using promises. You will need to use promises pattern to add callbacks to crawler method invocations.
var crawler = new TwitterCrawler(credentials);
crawler.getUser(/* CrawlerParameters */)
.then( /* Success Callback */ )
.catch( /* Error Callback */ )
crawler.getTweets(/* CrawlerParameters */, { limit: /* Desired limit, you can omit this */ })
.then( /* Success Callback */ )
.catch( /* Error Callback */ )API Methods
The available methods are the following ones:
getUser :: CrawlerParameters -> Promise- Obtain the user status from Twitter by callingusers/showmethod from Twitter API. Thethencallback will receive the user information.getTweets :: (CrawlerParameters[, CrawlerOptions]) -> Promise- Obtain User Tweets by callingstatuses/user_timelinemethod from Twitter API. Thethencallback will receive a list of tweets.
Definitions
CrawlerParameterscan be aTwitterIDor aTwitterParametersobject.TwitterIDis the numeric Twitter ID or the Twitter Handle.TwitterParametersis an object with parameters to be passed to Twitter API. E.g. this documentation shows thatGET statuses/user_timelinecan receive parameters such asuser_idorexclude_replies.Promiseis a promise as defined by BlueBird package.CrawlerOptionsis an object containing options for the crawling with attributes:limit: sets the max count of tweets to collect.min_tweets: forces a minimum tweet count. If set and not satisfied, it will result in rejection.