dylanmensaert
dylanmensaert

Reputation: 1739

How to get Playlist Id(s) containing given Video Id via youtube-api

At first glance, I can only retrieve playlists by id. Never related or containing a video id:

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

I only need the playlist meta data, so if possible without having to authenticate, except by key.

Bottomline:

If you click a video on youtube, 1 of the suggested items at the right of your screen is a playlist which contains the current video and multiple related video's.

I want to get that playlist or a list of video's that is very simular to this result. Is this possible?

Upvotes: 1

Views: 1695

Answers (1)

not_a_bot
not_a_bot

Reputation: 2362

Currently, I think the best way to get the list of playlists that contain a certain video is by using the search.list request. You will have to specify type=playlist and the title of the video for the q parameter. Note that this may not give you the playlists you're expecting if the title of the video isn't specific enough.

https://www.googleapis.com/youtube/v3/search?part=snippet&q=VIDEO_TITLE_HERE&type=playlist&key=API_KEY_HERE

Upvotes: 2

Related Questions