Created
April 16, 2016 12:25
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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