Skip to content

Instantly share code, notes, and snippets.

@passcod

passcod/current.js

Last active Aug 29, 2015
Embed
What would you like to do?
import Twitter from 'twitter';
const client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET
});
let getFaves = function () {
client.get('favorites/list.json?include_entities=true&count=20', function (error, tweets, response) {
if (error) throw error;
return tweets.reduce((memo, tweet) => {
const urls = tweet.entities.urls;
urls && urls.forEach(url => memo.push(url.expanded_url));
return memo;
}, []);
});
};
console.log(getFaves());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment