Created
April 10, 2022 23:27
-
-
Save melchisedech333/a2ae29187f2302eefd9af39f7b45d78a to your computer and use it in GitHub Desktop.
Extract youtube videos from playlist
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.getElementsByTagName('a'); | |
var urls = []; | |
for (var a=0; a<els.length; a++) { | |
var item = els[a].href.toString().trim(); | |
if (item.indexOf('watch') != -1) { | |
var url = item.split('&'); | |
url = url[0].toString().trim(); | |
var found = false; | |
for (var b=0; b<urls.length; b++) { | |
if (urls[b] == url) { | |
found = true; | |
break; | |
} | |
} | |
if (found == false) { | |
urls.push(url); | |
} | |
} | |
} | |
var list = ''; | |
for (var a=0; a<urls.length; a++) | |
list += urls[a] +"\n"; | |
document.body.innerHTML = `<textarea>`+ list +`</textarea>`; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment