Skip to content

Instantly share code, notes, and snippets.

@aripalo
Last active August 29, 2015 14:20
Show Gist options
  • Save aripalo/1e267d1d738acbcfc7ce to your computer and use it in GitHub Desktop.
Save aripalo/1e267d1d738acbcfc7ce to your computer and use it in GitHub Desktop.
Get Youtube playlist item titles
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