Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gillespieza/feb33bbc49d7c839114bf64a6c7fd287 to your computer and use it in GitHub Desktop.
Save gillespieza/feb33bbc49d7c839114bf64a6c7fd287 to your computer and use it in GitHub Desktop.
A simple script to download pluralsight courses in the browser console.
// open all sections
$$('section.module:not(.open) header').forEach((h) => h.click());
// get all list course videos in each section
let listItems = $$('section.module li');
// download them
for (let i = 0; i < listItems.length; i++) {
let listItem = listItems[i];
let title = listItem.querySelector('h3').textContent;
let number = `000${i}`.slice(-3);
let videoName = `${number}-${title}.mp4`;
listItem.click();
await new Promise((resolve) => setTimeout(resolve, 3000));
let video = document.querySelector('video');
let url = video.src;
const response = await fetch(url);
const blob = await response.blob();
let a = document.createElement('a');
a.href = window.URL.createObjectURL(blob);
a.download = videoName;
document.body.appendChild(a);
a.click();
a.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment