Skip to content

Instantly share code, notes, and snippets.

@alejandroiglesias
Created November 22, 2012 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandroiglesias/4132788 to your computer and use it in GitHub Desktop.
Save alejandroiglesias/4132788 to your computer and use it in GitHub Desktop.
Parrot Backfill
/*
* Parrot Backfill script.
*/
'use strict';
var config = require('./config.json');
var db = require('mysql').createConnection(config.db);
var twitter = require('tuiter')(config.twitter_api_keys);
//var Backfill = require('./lib/parrot-backfill');
console.log('twitter', twitter);
// Gets all app users.
db.query('SELECT * FROM account_account;', function (err, users) {
db.end();
users.forEach(function (user) {
// Get tweets for the user since last saved tweet.
var params = {
user_id: user.id,
since_id: user.last_safe_tweet_id || null
};
twitter.userTimeline(params, function (err, tweets) {
console.log('tweets', tweets);
tweets.forEach(function (tweet) {
// Save tweet.
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment