Last active
August 29, 2015 14:21
-
-
Save pixelcoder/4a05b5176496f260450e to your computer and use it in GitHub Desktop.
YouTube API v3: Get Playlist
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 channelName = 'newformat_is_ID_not_pretty_permalink'; | |
var vidWidth = 525; | |
var vidHeight = 325; | |
var vidResults = 6; | |
jQuery.get( | |
"https://www.googleapis.com/youtube/v3/channels", { | |
part: 'contentDetails', | |
forUsername: channelName, | |
key: '[API KEY]' | |
}, function(data){ | |
jQuery.each(data.items, function(i, item){ | |
pid = item.contentDetails.relatedPlaylists.uploads; | |
get_list_of_vids(pid); | |
}) | |
} | |
); | |
function get_list_of_vids(pid){ | |
jQuery.get( | |
"https://www.googleapis.com/youtube/v3/playlistItems",{ | |
part: 'snippet', | |
maxResults: vidResults, | |
playlistId: pid, | |
key: '[API KEY]' | |
}, function(data){ | |
jQuery.each(data.items, function(i, item){ | |
console.log(item); // Do something - Output video iFrame? View console for OBJECT | |
}) | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment