Nicholas Godoy
Nicholas Godoy

Reputation: 31

Android Studio: Insert a YouTube channel feed into my app?

So I want to put a tab into my app that shows a feed of the latest videos from a YouTube channel. The tab is already there, just need to discover how to put the videos. How would I accomplish that?

Upvotes: 0

Views: 3011

Answers (1)

heysupratim
heysupratim

Reputation: 423

You require the ID of the uploads playlist from the user

https://developers.google.com/youtube/v3/docs/channels/list#try-it

Do a http GET request like this

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=jambrose42&key={YOUR_API_KEY}

You can specify the username with the forUsername={username} param, or specify mine=true to get your own (you need to authenticate first). Include part=contentDetails to see the playlists.

In the result. Grab that "upload" playlist ID.

Next, get a list of videos in that playlist:

GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=50&playlistId=UUpRmvjdu3ixew5ahydZ67uA&key={YOUR_API_KEY}

For Reference -

https://developers.google.com/youtube/v3/docs/playlistItems/list#try-it

Upvotes: 1

Related Questions