RayT
asked on
YouTube Data API
I have to convert my working v2 code and now I can't seem to get this to work.
I'm trying to retrieve all videos from a selected YouTube channel. What is wrong with the following code?
I'm trying to retrieve all videos from a selected YouTube channel. What is wrong with the following code?
var YouTube = {
LoadVideos: function (channelName, apiKey, maxNumberOfVideos) {
$(document).ready(function () {
$.get("https://www.googlesapis.com/youtube/v3/channels", {
part: "contentDetails",
forUserName: channelName,
key: apiKey},
function (data) {
$.each(data.items, function (i, item) {
pid = item.contentDetails.relatedPlaylists.uploads;
getVideos(pid, apiKey, maxNumberOfVideos);
})
}
);
});
},
getVideos: function (pid, apiKey, maxNumberOfVideos) {
$.get("https://www.googlesapis.com/youtube/v3/playlistItems", {
part: "snippet",
maxResults: maxNumberOfVideos,
playlistId: pid,
key: apiKey},
function (data) {
$.each(data.items, function (i, item) {
})
}
);
},
PlayVideo: function (url, width, height) {
$('#ytplayer').attr('src', url);
$('#ytplayer').attr('width', width);
$('#ytplayer').attr('height', height);
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER