Skip to content

Instantly share code, notes, and snippets.

@punchouty
Created May 1, 2016 17:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save punchouty/ea3f42968630face1323540bb67dc0c3 to your computer and use it in GitHub Desktop.
Save punchouty/ea3f42968630face1323540bb67dc0c3 to your computer and use it in GitHub Desktop.
Pluralsight Video Download
//Login to pluralsight in chrome and Open a course you want to download
//Example - https://app.pluralsight.com/library/courses/aws-automating-cloudformation/table-of-contents
//Click on "Start" or "Resume Course" Button
//chapter listing
var list = document.getElementsByTagName("section");
var counter=0;
for (var i=0; i<list.length; i++) {
if ( list[i].className.match(/\bmodule\b/) ) {
var header_text = list[i].getElementsByTagName("h2")[0].innerText;
var ul = list[i].getElementsByClassName('clips');
var li_list = ul[0].getElementsByClassName('title');
if ( li_list.length > 0 ) {
console.log("------" + header_text + "------");
for (var y=0; y<li_list.length; y++) {
counter += 1;
console.log(counter + " - " + li_list[y].innerText); // chapter listing
}
console.log(" ");
console.log(" ");
}
}
}
// function to down load video
function downloadVideo(uri, name) {
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
}
//RUN above in chrome "console"
// Download current playing video
downloadVideo(document.getElementsByTagName('video')[0].src, "overview.mp4")
@PrasadSiri
Copy link

If the above code is not working then please use newly edited code

var list = document.getElementsByTagName("section");
var counter=0;
for (var i=0; i<list.length; i++) {
if ( list[i].className.match(/\bmodule\b/) ) {
var header_text = list[i].getElementsByTagName("h2")[0].innerText;
var ul = list[i].getElementsByClassName('clips');
var li_list = ul[0].childNodes
if ( li_list.length > 0 ) {
console.log("------" + header_text + "------");
for (var y=0; y<li_list.length; y++) {
counter += 1;
var strCounter = "" + counter
var pad = "000"
strCounter = pad.substring(0, pad.length - strCounter.length) + strCounter
var titleTextLength = li_list[y].innerText.indexOf("\n");
console.log(strCounter + " - " + li_list[y].innerText.substr(0,titleTextLength)); // chapter listing
}
console.log(" ");
console.log(" ");
}
}
}

@iampato
Copy link

iampato commented Dec 19, 2018

TypeError: ul[0] is undefined[Learn More]

i get this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment