user1130862
user1130862

Reputation: 91

Google Youtube API v3 Playlist title

I am trying to port a application developed using version 2 API of google youtube to version 3.

How can I get title of a playlist using version 3 API? We could get the title of playlist using version 2. However, title I get when I query playlist's snippet is different from what it is shown on the youtube website.

Is there any difference in Version 3?

I am using .NET API library from Google. if this helps.

Can anyone please help?

EDITED: 20-MAY-2014

Sorry for the delay in response. I tried using Version 3 API from Google and when I am trying to get playlists using

var channelsListRequest = youtubeService.Channels.List("snippet,contentDetails");

after setting channelsListRequest.ForUserName, i call var channelsListResponse = await channelsListRequest.ExecuteAsync();

From the response, I would then get the playlist list sent using:

foreach (var channel in channelsListResponse.Items)
        {
            var uploadsListId = channel.ContentDetails.RelatedPlaylists.Uploads;
            var nextPageToken = "";
            while (nextPageToken != null)
            {
                var playlistRequest = youtubeService.Playlists.List("id,snippet,contentDetails,status,player");
                playlistRequest.Id = uploadsListId;
                playlistRequest.MaxResults = 50;
                playlistRequest.PageToken = nextPageToken;
                var playlistListResponse = await playlistRequest.ExecuteAsync();
                if (playlistListResponse.Items.Count > 0)
                    MessageBox.Show(playlistListResponse.Items[0].Snippet.Title);

        }

The messagebox displays the comment that was added when creating playlist. However, when I view in youtube using a browser, the playlist title is displayed properly.

Upvotes: 2

Views: 3164

Answers (2)

Kody
Kody

Reputation: 59

Please try the following link, and change the play

https://www.googleapis.com/youtube/v3/playlists?part=snippet%2Clocalizations&id=" + playlistId + "&fields=items(localizations%2Csnippet%2Flocalized%2Ftitle)&key=" + KEY;

Upvotes: 5

user3703012
user3703012

Reputation: 7

Implementation and Migration Guide: https://developers.google.com/youtube/v3/guides/implementation

I am new to the YouTube API implementation, so please use the Implementation and Migration Guide above for more information, but from what I have discovered myself using the API Explorer: https://developers.google.com/apis-explorer/#p/youtube/v3/. Is that you need to use youtube.playlists.list(snippet,[id]). Replace [id] with the ID of your playlist.

Upvotes: -1

Related Questions