Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FuruholmAnton/db70d0e489e8dbcc200461f724260552 to your computer and use it in GitHub Desktop.
Save FuruholmAnton/db70d0e489e8dbcc200461f724260552 to your computer and use it in GitHub Desktop.
Extract Shorts from a YouTube playlist and adds a watch link to them that can be embedded on a website.
var els = document.getElementsByClassName('reel-item-endpoint');
var ids = [];
for(i = 0; i < els.length; i++) {
var el = els[i];
if(el) {
if (!el.href || !el.href.match(/shorts\/([a-zA-Z0-9_-]+)$/)) {
continue;
}
ids.push('https://www.youtube.com/watch?v=' + el.href.split('/shorts/')[1].split('/')[0]);
}
}
console.log(ids.join("\r\n"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment