Skip to content

Instantly share code, notes, and snippets.

@witnessmenow
Created April 16, 2016 12:25
Show Gist options
  • Save witnessmenow/bb5a7842a665a9c5076cdbd3f763da08 to your computer and use it in GitHub Desktop.
Save witnessmenow/bb5a7842a665a9c5076cdbd3f763da08 to your computer and use it in GitHub Desktop.
mrwgame.com specific. Takes a list of our keen objects and gets back the gfycat details. getGifycatLinkDetails goes to gfycat and checks does the link exist and uploads if it doesn't. Returns a promise that resolves when all keen objects have been converted.
var getGfycatUrlsForKeenList = (keenEntries) => {
var promises = keenEntries.map((entry) => {
return new Promise((resolve, reject) => {
GfycatClient.getGifycatLinkDetails(entry.reaction)
.then((gfycatDetails) => {
if(!gfycatDetails.mp4Url){
}
resolve({
title : entry.question,
documentId : entry.reaction,
thumbnail : getPictureLink(entry.reactionPic),
mp4Url : gfycatDetails.mp4Url,
webmUrl : gfycatDetails.webmUrl,
timestamp : entry.timestamp,
timeSince : entry.timeSince
});
});
});
});
return Promise.all(promises)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment