\"googleapis\": \"^16.1.0\"
I have a playlist where there are two videos. How can I get the videos ids?
I tried this:
// Node.js
const google
With Axios you can do something like that :
import axios from "axios";
const KEY = "";
const getPlayListItems = async playlistID => {
const result = await axios.get(`https://www.googleapis.com/youtube/v3/playlistItems`, {
params: {
part: 'id,snippet',
maxResults: 10,
playlistId: playlistID
key: KEY
}
});
return result.data;
};
getPlayListItems("PlaylistID").then(data => {
data.items.forEach(element => {
console.log(element.snippet.resourceId.videoId)
});
This will print all videoId of a given playlist, up to position 10.