clay-instagram
Advanced tools
Comparing version
@@ -9,3 +9,3 @@ { | ||
"description": "An instagram embed component for Clay.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "server.js", | ||
@@ -12,0 +12,0 @@ "repository": { |
@@ -10,2 +10,16 @@ 'use strict'; | ||
/** | ||
* determine if an instagram post should hide its caption | ||
* @param {object} data | ||
* @returns {string} | ||
*/ | ||
function hideCaption(data) { | ||
if (data.showThread === false) { | ||
return '&hidecaption=true'; | ||
} else { | ||
// if it's true (default) or undefined | ||
return ''; | ||
} | ||
} | ||
/** | ||
* grab html for tweet | ||
@@ -19,3 +33,3 @@ * @param {string} ref | ||
// note: we're using the un-authenticated api endpoint. don't abuse this | ||
return fetch('https://api.instagram.com/oembed/?url=' + encodeURI(data.url) + '&omitscript=true') | ||
return fetch('https://api.instagram.com/oembed/?url=' + encodeURI(data.url) + '&omitscript=true' + hideCaption(data)) | ||
.then(function (res) { | ||
@@ -22,0 +36,0 @@ // get json from result |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7615
9.1%87
17.57%