Last active
August 29, 2015 14:20
-
-
Save aripalo/1e267d1d738acbcfc7ce to your computer and use it in GitHub Desktop.
Get Youtube playlist item titles
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
function getTitles(optionalTrimPrefix) { | |
var elems = document.querySelectorAll('#playlist-autoscroll-list .playlist-video-description h4.yt-ui-ellipsis-2'); | |
var titles = []; | |
for (i = 0; i < elems.length; i++) { | |
var text = elems[i].textContent; | |
var title = optionalTrimPrefix ? text.substr(optionalTrimPrefix.length) : text; | |
if(title) titles.push(title); | |
} | |
return titles; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment