Created
April 3, 2025 12:32
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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