Skip to content

Instantly share code, notes, and snippets.

@lukaskollmer
Last active October 17, 2018 11:16
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 lukaskollmer/e76886578e611cc758f73680bdd21999 to your computer and use it in GitHub Desktop.
Save lukaskollmer/e76886578e611cc758f73680bdd21999 to your computer and use it in GitHub Desktop.
const replaceAll = (target, pattern, replacement) => {
return target.replace(new RegExp(pattern, 'g'), replacement);
};
const filterHdUrl = urls => {
for (const url of urls) {
if (url.label === 'HD') return url;
}
return urls[1];
};
const downloadUrl = filterHdUrl(lecturioJwplayer.playerJson.content.media).file;
const courseName = document.getElementsByClassName('breadcrumb_item bc_basic_course')[0].children[0].text
const lectureName = document.getElementsByClassName('breadcrumb_item bc_lecture')[0].textContent.trim()
const filename = replaceAll(`${courseName} - ${lectureName}.mp4`, '/', '-');
console.log(`wget -c '${downloadUrl}' -O '${filename}'`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment