YouTube channel video in website

How to load/list YouTube channel Videos?

Here we will see how we can load YouTube channel video in our website by using JSON.

There are two steps:

Query Channels to get the “uploads” Id. eg

Use this “uploads” Id to query PlaylistItems to get the list of videos. eg

Now we will start this from scratch

STEP 1 (Get API Key):
We will get ‘API Key’ from Google Developer Console, you can find steps here : https://developers.google.com/youtube/v3/getting-started

STEP 2 (Get Channel ID):
Go to your YouTube Channel and copy your channel URL e.g. https://www.youtube.com/channel/XXXXXXXThs2cnXXX-dt
and your channel id is ‘XXXXXXXThs2cnXXX-dt‘.

STEP 3 :
Now replace {channel Id} with your channel id and API Key with your API Key
https://www.googleapis.com/youtube/v3/channels?id={channel Id}&key={API key}&part=contentDetails
to
https://www.googleapis.com/youtube/v3/channels?id=XXXXXXXThs2cnXXX-dt&key=XXXXXXXXXXXXXXXXXXX&part=contentDetails

Here you will get “uploads” Id to query Playlist Items e.g.

“uploads”: “XXXXwEk6hThs2cnzXXXX” is the upload id

STEP 4 :
Use this “uploads” Id to query PlaylistItems to get the list of videos. eg

 

Here you will get Palaylist in json Format.

Leave a Reply

Your email address will not be published. Required fields are marked *