dimanche 19 juin 2016

Retrieve number of items in playlist with YouTube API v3

I'm transferring my iOS code from YouTube Data API v2 to v3.

I would like to retrieve the number of items in a playlist with YouTube API v3.

With the data API v2, I could call a search query, resulting in a list of playlist items with the property "size", which represented the size of the playlist, see:

https://gdata.youtube.com/feeds/api/playlists/snippets?q=GoogleDevelopers&max-results=10&v=2&alt=jsonc

With API v3, I haven't found a way to achieve this. I tried queries, like below, not resulting in the desired output.

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

The only way to get the number of items is running a query for each playlist, retrieving the full playlist items. This is an overkill, however, and results in a too high API usage. https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=RD0KSOMA3QBU0&key={YOUR_API_KEY}

Any help appreciated!

Thanks

Aucun commentaire:

Enregistrer un commentaire