Skip to content

Instantly share code, notes, and snippets.

@dueyfinster
Last active February 14, 2023 11:58
Show Gist options
  • Select an option

  • Save dueyfinster/1093c51dd98b1d53666234404c182b30 to your computer and use it in GitHub Desktop.

Select an option

Save dueyfinster/1093c51dd98b1d53666234404c182b30 to your computer and use it in GitHub Desktop.
Download Video Course Files from Pragmatic Studio
(function(console){
console.save = function(url, filename){
if(!url) {
console.error('Console.save: No url')
return;
}
if(!filename) {
console.error('Console.save: No filename')
return;
}
var a = document.createElement('a');
var e = document.createEvent('MouseEvents');
a.download = filename.replace('.','') + ".mp4";
a.href = url;
a.dataset.downloadurl = ['video/mp4', a.download, a.href].join(':');
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
a.dispatchEvent(e);
}
console.sleep = function(ms){
return new Promise(resolve => setTimeout(resolve, ms));
}
})(console)
var x = document.querySelectorAll('tr td');
async function dload(){
for (var i=0 ; i<x.length; i+=2){
console.save( x[i+1].querySelector('a').href, x[i].innerHTML.trim());
await console.sleep(5000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment