Get video feeds using Youtube API v3

2.2k views Asked by At

We have a website which displays our YouTube video channels and favourite videos in our channel, etc. We were using Youtube Data API v2.0 to fetch data.

for example:

https://gdata.youtube.com/feeds/api/users/" + userid + "/playlists?v=2&alt=json-in-script&orderby=" + orderFeedsBy + "&callback=?

But now these links return "NetworkError: 410 Gone". We checked the new YouTube Javascript API, but we didn't understand how to migrate to the new API. Please help us to fix this.

2

There are 2 answers

0
Alex On

This URL will return JSON with video ids for a playlist: https://www.googleapis.com/youtube/v3/playlistItems?part=id&playlistId={PLAYLIST_ID}&key={YOUR_API_KEY}

You will need an API Key from console.developers.google.com and the playlist ID.

You can get a list of playlist IDs for a channel with a URL like this:

https://www.googleapis.com/youtube/v3/playlists?part=id&channelId={CHANNEL_ID}&key={YOUR_API_KEY}

Documentation at developers.google.com/youtube/v3/docs/

0
Lakshmi Deepak Kandru On

Youtube stopped support to V2, so to get data from V3 use the below URL

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId={PLAYLIST_ID}&key={KEY}