Last active
November 19, 2018 23:58
-
-
Save tiborsaas/c89c44941447443168a0 to your computer and use it in GitHub Desktop.
Export YouTube favorites
This file contains 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 saveHTML = function(fileName, html){ | |
var link = document.createElement("a"); | |
link.download = fileName; | |
link.href = "data:text/plain,"+html; | |
link.click(); | |
}; | |
var links = document.querySelectorAll('a.ytd-playlist-video-renderer'); | |
var collection = ''; | |
for( i=0; i<links.length; i++){ | |
collection += '<tr><td>https://www.youtube.com/watch?v=' + links[i].href.split('v=')[1].split('&')[0] + '</td><td>' + links[i].querySelector('#video-title').textContent + '</td></tr>'; | |
} | |
saveHTML("export.html", "<html><meta charset='utf-8'><title>YouTube exports</title><body><table>"+collection+"</table></body></html>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment