Simple nodejs script to convert timeline from twitter (https://dev.twitter.com) to twtxt (https://github.com/buckket/twtxt) format.
$ npm install twitter moment
$ convert.js > ~/twtxt.txt
var Twitter = require("twitter"); | |
var moment = require("moment"); | |
var client = new Twitter({ | |
consumer_key: 'XXX', /* copy from https://apps.twitter.com/app/APPID/keys */ | |
consumer_secret: 'XXX2', /* copy from https://apps.twitter.com/app/APPID/keys */ | |
access_token_key: '', | |
access_token_secret: '' | |
}); | |
var params = {screen_name: 'YOURUSERNAME'}; /* e.g. dracoblue */ | |
client.get('statuses/user_timeline', params, function(error, tweets, response){ | |
if (!error) { | |
tweets.forEach(function(tweet) { | |
console.log(moment(new Date(Date.parse(tweet.created_at.replace(/( \+)/, ' UTC$1')))).format('YYYY-MM-DDTHH:mm:ss.SSSZ') + "\t" + tweet.text.replace(/[\n\r]/g, " ")); | |
}); | |
} | |
}); |
Simple nodejs script to convert timeline from twitter (https://dev.twitter.com) to twtxt (https://github.com/buckket/twtxt) format.
$ npm install twitter moment
$ convert.js > ~/twtxt.txt
2016-02-06T11:48:23.000+01:00 RT @hackernewsbot: Show HN: Twtxt – Decentralised, minimalist microblogging service for hackers... https://t.co/QetAUkvYZI | |
2016-02-06T08:56:26.000+01:00 RT @Real_CSS_Tricks: This is _good_ advice for making good slides of any kind: https://t.co/DcWwJIA1Zb by @ilikevests | |
2016-01-31T23:14:55.000+01:00 "Local Elasticsearch Cluster Status = RED" https://t.co/WZumSoKQwj |