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

Youtube API for auto-generated channels (topics) doesn't return valid playlist

$
0
0

I'm trying to retrieve videos related to "Auto-generated" youtube channel.

While it works some time ago (at least in 2023),recently I been faced issue — there are no more playlists like "Popular", or "Recent" returned by channels api, only "Uploads".

But even "Uploads" playlist doesn't have valid playlistId —playlistItems api throws error "The playlist identified with the request's playlistId parameter cannot be found."

Here's the sample code:

const YT_KEY = ""; // put your google api key hereconst YT_AUTO_CHANNEL_ID = "UCNXJk0T4LRLpWS5XlVSg4uQ";fetch(`https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails&id=${YT_AUTO_CHANNEL_ID}&key=${YT_KEY}`)  .then((response) => response.json())  .then((json) => {    console.log("Channel's related \"Uploads\" playlistId", json.items[0]?.contentDetails.relatedPlaylists.uploads);    if (json.items[0]?.contentDetails.relatedPlaylists.uploads) {      fetch(`https://youtube.googleapis.com/youtube/v3/playlistItems?part=id%2CcontentDetails%2Csnippet&playlistId=${json.items[0].contentDetails.relatedPlaylists.uploads}&maxResults=50&key=${YT_KEY}`)        .then((response) => response.json())        .then((json) => {          console.log("\"Uploads\" playlist videos response", json);        });    }  });

What can be solution for that?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



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