Created
November 22, 2012 20:19
-
-
Save alejandroiglesias/4132788 to your computer and use it in GitHub Desktop.
Parrot Backfill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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