Retrieve array of video IDs from youtube playlist ID

Jacob Pedersen

I want to retrieve an array of video ID's using a youtube playlist ID.

Basicually a function getPlaylist(playlist) that returns

[{'title':'Video1 Title', 'ID':'Video1 ID'},
{'title':'Video2 Title', 'ID':'Video2 ID'},
{'title':'Video3 Title', 'ID':'Video3 ID'}];

I currently have this, but making it return data in an array would require a major rewrite, and I'm not sure how to approach it.

I want to be able to do var stuff = getPlaylist(ID);, and reference the entered ID like stuff[4].title and so, and easily handle the response in for loops etc.

I want to do this with as few lines of code as possible, and without libraries and API's (like jQuery and the youtube javascript API).

Xotic750

Create a variable outside of the loop

var arrayOfvideoIDs = [];

inside your loop

for (....) {
    ...
    list_data += '<li>'+videoID+'</li>';
    arrayOfvideoIDs.push(videoID);
}

You now have an array of videoIDs

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Get all playlist ids from channel id - youtube api v3

Retrieve Video IDs contained in a Playlist - YouTube API v3

Regex to extract both video id or playlist id from youtube url

How do I retrieve individual video URLs from a playlist, using youtube-dl within a python script?

Get video information from a list of playlist with youtube-dl

Add video to Youtube playlist NodeJS

How to get video title and thumbnail from YouTube Playlist

How to get a video from a youtube playlist by count using java?

Retrieve Video Stream from Youtube Link

How do I create a playlist from multiple video IDs on youtube?

youtube API get all playlist id from a channel : python

how to build video playlist having youtube videos?

Get all video ID's from a YouTube playlist into a PHP array

extract private youtube playlist video links

YouTube Objective-C API video url from playlist item

Always get latest video in YouTube playlist

How to Get Video IDs from Youtube video feeds?

YouTube Regex: Tested to pick up both video and playlist ID, yet Node.js won't

Retrieve video ids from playlist id - youtube api v3

Retrieve videos from youtube playlist

youtube player api - playlist of video not created

Scraping YouTube playlist video links

Latest youtube video from specific playlist

Retrieve video ID from YouTube link

Regex > get YouTube Playlist ID?

Play YouTube videos from an array of video IDs : React

Do youtube account IDs, playlist IDs or video IDs automatically change or update periodically?

Retrieve youtube ID in a multidimensional array

Google Apps Script: Retrieve most recent video ids from Youtube API v3 as array