0.1.0 • Published 6 years ago

twitter-account-crawler v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

twitter-account-crawler XO code style

Collect random users on Twitter.

NOTE: Currently only supports Japanese users.

API

new TwitterAccountCrawler(keys)

Returns the instance of the crawler.

keys consists of consumer_key, consumer_secret, token, and token_secret.

.on('account', callback)

The event emitted when the crawler gets an account.

callback takes Twitter user object as parameter.

.start()

Starts the crawler.

.stop()

Stops the crawler.

Usage

const TwitterAccountCrawler = require('twitter-account-crawler');

// Initialize with Twitter app credentials
const crawler = new TwitterAccountCrawler({
	consumer_key: 'SUPER_SECRET_CONSUMER_KEY',
	consumer_secret: 'SUPER_SECRET_CONSUMER_SECRET',
	token: 'SUPER_SECRET_TOKEN',
	token_secret: 'SUPER_SECRET_TOKEN_SECRET',
});

// Define callback, for example
crawler.on('account', account => {
	someDatabase.insert({id: account.id_str});
});

// Start the crawler
crawler.start();

// Stop the crawler
crawler.stop();

License

MIT