Created
June 11, 2017 20:57
-
-
Save emerson-pereira/23d58f18f86c38dc5621ffeb04a9194f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ids = [ ... ]; | |
ids.forEach(function(id, i){ | |
callApi(id); | |
}); | |
function callApi(videoId) { | |
$.ajax({ | |
type: 'GET', | |
dataType: 'json', | |
// async: false, | |
url: 'https://www.googleapis.com/youtube/v3/videos?id='+ videoId +'&key= [key] &part=snippet,contentDetails,statistics,status', | |
success: handler | |
}); | |
} | |
function handler(res) { | |
vtitle = res.items[0].snippet.title; | |
// console.log(res); | |
console.log(vtitle); | |
$('#' + res.items[0].id).html(vtitle) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment