Skip to content

Instantly share code, notes, and snippets.

@emerson-pereira
Created June 11, 2017 20:57
Show Gist options
  • Save emerson-pereira/23d58f18f86c38dc5621ffeb04a9194f to your computer and use it in GitHub Desktop.
Save emerson-pereira/23d58f18f86c38dc5621ffeb04a9194f to your computer and use it in GitHub Desktop.
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