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

Retrieve video ids from playlist id - youtube api v3

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

Retrieve Video IDs contained in a Playlist - YouTube API v3

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

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

Retrieve videos from youtube playlist

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

Retrieve video ID from YouTube link

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

Latest youtube video from specific playlist

Get all playlist ids from channel id - youtube api v3

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

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

How to get video title and thumbnail from YouTube Playlist

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

YouTube Objective-C API video url from playlist item

Add video to Youtube playlist NodeJS

Scraping YouTube playlist video links

Retrieve Video Stream from Youtube Link

How to Get Video IDs from Youtube video feeds?

youtube API get all playlist id from a channel : python

Regex > get YouTube Playlist ID?

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

youtube player api - playlist of video not created

Always get latest video in YouTube playlist

how to build video playlist having youtube videos?

extract private youtube playlist video links