Created
November 19, 2014 18:20
-
-
Save csmatt/6c0aa42c2e244b5e89c0 to your computer and use it in GitHub Desktop.
Produces right-click-save-as links for Coursera courses. Only works for the Software Security course at the moment.
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
// While logged in, go to https://class.coursera.org/softwaresec-001 and select a week under Weekly Content. | |
// Run this script in the dev console and it'll put links at the top of the page that you can right-click-save-as | |
var lectLink = $("a[href^='https://class.coursera.org/softwaresec-001/lecture/view?lecture_id=']"), | |
prefix = location.pathname.split(/.*\/wiki\//)[1], | |
vidLinkContainer = $("<div id='vidLinkContainer'/>"); | |
$("#vidLinkContainer").remove(); | |
$("body").prepend(vidLinkContainer); | |
lectLink.each(function(index) { | |
var lectTitle = $(this).text(), | |
lectHref = $(this).attr("href"); | |
$.get(lectHref).then(function(response) { | |
var vidSrc = $("source[type='video/mp4']", response).attr("src"), | |
downloadFileName = prefix+"_"+index+"_"+lectTitle.replace(" ", "_")+".mp4", | |
vidLink = $("<a></a>").attr({href: vidSrc, download: downloadFileName}).text(lectTitle); | |
vidLinkContainer.append("<br />"); | |
vidLinkContainer.append(vidLink); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment