Last active
October 17, 2018 11:16
-
-
Save lukaskollmer/e76886578e611cc758f73680bdd21999 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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