Skip to content

Instantly share code, notes, and snippets.

@passcod
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passcod/40351db34db459ebaf1c to your computer and use it in GitHub Desktop.
Save passcod/40351db34db459ebaf1c to your computer and use it in GitHub Desktop.
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