Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Poor mans twitter to twtxt converter
var Twitter = require("twitter");
var moment = require("moment");
var client = new Twitter({
consumer_key: 'XXX', /* copy from */
consumer_secret: 'XXX2', /* copy from */
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, " "));
2016-02-06T11:48:23.000+01:00 RT @hackernewsbot: Show HN: Twtxt – Decentralised, minimalist microblogging service for hackers...
2016-02-06T08:56:26.000+01:00 RT @Real_CSS_Tricks: This is _good_ advice for making good slides of any kind: by @ilikevests
2016-01-31T23:14:55.000+01:00 "Local Elasticsearch Cluster Status = RED"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment