Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var videoLink = document.querySelector(".vjs-tech").getAttribute('src');
- var oReq = new XMLHttpRequest();
- oReq.onload = function (oEvent) {
- var blob = oReq.response;
- var url = window.URL.createObjectURL(blob);
- var a = document.createElement('a');
- a.style = "display: none";
- a.href = url;
- a.download = getCourseName()+'.mp4';
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- window.URL.revokeObjectURL(url);
- };
- oReq.open("GET",videoLink,true );
- oReq.responseType = "blob";
- oReq.send();
- function getCourseName() {
- var listTagNames = document.getElementsByTagName("LI")
- for(var i = 0; i < listTagNames.length; i++) {
- var obj = listTagNames[i].getAttribute("aria-current");
- if (obj == "true") {
- var content = listTagNames[i];
- var courseName = content.getElementsByTagName("div")[0].getAttribute("aria-label");
- return courseName;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment