Last active
April 23, 2023 17:54
-
-
Save abhinav4848/880ef0468d1b1d8fb78660a65332cc4b to your computer and use it in GitHub Desktop.
Download videos from lecturio. Read comments below
This file contains hidden or 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
'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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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