Skip to content

Instantly share code, notes, and snippets.

@Koushikphy
Created September 23, 2022 14:57
Show Gist options
  • Save Koushikphy/d8912fdd145e55dc212eef2791766a20 to your computer and use it in GitHub Desktop.
Save Koushikphy/d8912fdd145e55dc212eef2791766a20 to your computer and use it in GitHub Desktop.
Download all videos of any YouTube playlist

Open the playlist page in a browser and open the developer console and paste this JS code

var tmpLink = document.createElement('a');
tmpLink.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(
    [...document.querySelectorAll("a#video-title")].map(e => {
        let link = e.getAttribute('href')
        let onlyLink = "https://www.youtube.com/" + link.split("&")[0]
        return onlyLink
    }).join("\n"))
);
tmpLink.setAttribute('download', 'links.txt');
tmpLink.click()

This will download all the links of the videos in the list as a plain txt file.

Now use yt-dlp to download the videos

yt-dlp.exe -a links.txt -N 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment