Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

I need help getting video ids from a playlist in youtube

$
0
0

I'm trying to fetch all the video ids from a playlist on YouTube. Currently, I have things almost working, except the ids that YouTube is returning a much longer than usual and don't seem to work. Here's part of my code:

const requestUrl = `https://www.googleapis.com/youtube/v3/playlistItems?key=${process.env.KEY}&playlistId=${id}&part=id&maxResults=40`

The result under data.items looks like this:

[  {    kind: 'youtube#playlistItem',    etag: 'DxS1pY8G6dwZwfAUJeE8naJEvXM',    id: 'T0xBSzV1eV9uUHdpaDVQbWY3aEJWQ1Q2LU14bVFOTGFBSVAwellYVGsuRUVCNzhFRENBQzBENDM4MA'  },  {    kind: 'youtube#playlistItem',    etag: 'hi9WR5RovxYzHpBXddP__e5nFSA',    id: 'T0xBSzV1eV9uUHdpaDVQbWY3aEJWQ1Q2LU14bVFOTGFBSVAwellYVGsuQzVBOTAwNjQ1OTJFMTVBRg'  }etc...

However those ids are much longer than normal and when I go to for example

youtube.com/watch?v=T0xBSzV1eV9uUHdpaDVQbWY3aEJWQ1Q2LU14bVFOTGFBSVAwellYVGsuRUVCNzhFRENBQzBENDM4MAthe url automatically gets shortened to https://www.youtube.com/watch?v=T0xBSzV1eV9 and I get a video unavailable screen. When I changed &part=id to &part=snippet, the same thing happened, I just got more video info.

Thanks in advance!


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>