I'm currently trying to make a site which uploads all the videos from specific playlist of some channel. Like list of videos. And I found this video - link. And that's what I have now:
$(document).ready(function() {
$.get(
"https://www.googleapis.com/youtube/v3/channels",{
part : 'contentDetails',
forUsername : 'CHANNEL_NAME',
key: 'MY_KEY'},
function(data) {
$.each( data.items, function( i, item ) {
console.log(item);
})
}
);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
But I have nothing in console, though judging by console.log(item)
something must be there, at least undefined
. And even when I write just console.log('hi')
I still have nothing. I just can't understand what's wrong. Anyway, I'd be very thankful for any help.
It's at the top of the screen. This expands the search bar. Type the channel name into the "Search YouTube" bar. If you don't know the name of the channel, you can search for any keyword(s) that might bring it up in a search, such as the name of a video shared by the channel, a genre, etc.
You can retrieve entire playlists, users' uploads, and even search results using the YouTube API. You can also add YouTube functionalities to your website so that users can upload videos and manage channel subscriptions straight from your website or app.
If I understood your question correctly, you want to retrieve videos of a specific channel. You should use https://www.googleapis.com/youtube/v3/search
endpoint instead of https://www.googleapis.com/youtube/v3/channels
. So, I provided an example with channelId
and type
parameters; (type
parameter can be video, playlist, channel
)
$(document).ready(function() {
$.get(
"https://www.googleapis.com/youtube/v3/search",{
part : 'snippet',
channelId : 'UCR5wZcXtOUka8jTA57flzMg',
type : 'video',
key: 'MyKey'},
function(data) {
$.each( data.items, function( i, item ) {
console.log(item);
})
}
);
});
This will get you videos of a channel. If you want to get playlists of channel just change type
parameter to playlist
. Here is the official documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With