androidmobileyoutubeandroid-youtube-apiyoutube-data-api

How to fetch user's Youtube Playlist by YouTube API in android?


Is there any way for me to get user's playlist by AccountPicker?

Could somebody show me the exactly workflow?

I already read this https://developers.google.com/youtube/v3/docs/playlists/list


Solution

  • Try this:-

    First of all you need to create project in https://console.developers.google.com and get API key, Check this link for console registration process and how to get API key.it may help.

    After that follow this process

    1. Get the channel id for the channel you want from here (you probably only need to do this once, then you can save it)

      Set forUsername to the name of the channel you want

      Grab the channel id (something like this: "id": "UCrX2VuXXXXXXXXXXXXXXXX")

    2. Get the playlist from channel id you get in step 1:-

      Here you can check playlist by entering channel id which you get from step 1

    3. Get the videos via the playlistitems in the playlist using the playlist id from step 2

      Go through each PlaylistItem and pull out the videoId and pass that videoId to Youtube player

    At last after this all process you have link like this as below.

    And here is your final URL to get PlayList:-

    https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId={ChannelID}&key={API key} & maxResults=50

    And to get PlaylistItems:

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

    Thats it. Let me know if you face any issue.

    UPDATE 1:-

    Check this link to get channel id from channel name

    enter image description here enter image description here