Created
December 16, 2013 16:13
-
-
Save jonaslund/7989629 to your computer and use it in GitHub Desktop.
In Search Of Lost Time
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
var consumer_key = '', | |
consumer_secret = '', | |
oauth_token_secret = '', | |
user_id = '', | |
oauth_token = '', | |
screen_name = '', | |
fs = require("fs"), | |
cronJob = require('cron').CronJob; | |
var twitterAPI = require('node-twitter-api'); | |
var twitter = new twitterAPI({ | |
consumerKey: consumer_key, | |
consumerSecret: consumer_secret, | |
callback: 'http://jonaslund.biz' | |
}); | |
new cronJob('0 * * * *', function(){ | |
fs.readFile("swans_way.txt", "utf-8", function(err, data) { | |
var tweet = data.substr(0, 140); | |
var remaining = data.substr(140); | |
twitter.statuses("update", { | |
status: tweet | |
}, | |
oauth_token, | |
oauth_token_secret, | |
function(error, data, response) { | |
if (error) { | |
console.log(error); | |
} else { | |
console.log("success"); | |
fs.writeFile("swans_way.txt", remaining, "utf-8", function(err) { | |
if(err) { | |
console.log(err); | |
} | |
}); | |
} | |
} | |
); | |
}); | |
}, null, true, "France/Paris"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment