Skip to content

Instantly share code, notes, and snippets.

@abhinav4848
Last active April 23, 2023 17:54
Show Gist options
  • Save abhinav4848/880ef0468d1b1d8fb78660a65332cc4b to your computer and use it in GitHub Desktop.
Save abhinav4848/880ef0468d1b1d8fb78660a65332cc4b to your computer and use it in GitHub Desktop.
Download videos from lecturio. Read comments below
'use strict';
function copy(ele) {
let temp = document.createElement('textarea');
document.body.appendChild(temp);
temp.value = ele.replace(/:/, '-');
temp.select();
document.execCommand('copy');
temp.remove();
}
function downloadURI(uri, name) {
window.open(uri, '_blank');
}
let url = document.getElementsByTagName("video")[0].src;
let title = document.getElementsByTagName("h5")[0];
let titleText = title.lastChild.wholeText;
let btn = document.createElement("button");
btn.innerHTML = "Download";
btn.onclick = ()=>{
copy(titleText);
downloadURI(url, titleText);
}
title.insertBefore(document.createElement('br'), title.childNodes[0]);
title.insertBefore(btn, title.childNodes[0]);
btn.click()
@abhinav4848
Copy link
Author

Go to Chrome developer tools->Sources->New Snippet. Give snippet any name, eg: test, then paste code. hit Ctrl+enter. Download button appears below video. Click it, Video opens in new tab. Hit Ctrl+S. Then give name by pressing Ctrl + V (Name was already copied to clipboard). and hit enter. Watch this video for more: https://www.youtube.com/watch?v=U4dSWJFIQ0A

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