Last active
August 19, 2017 22:29
-
-
Save helton/25eef9aab5c453d0bf8883e12866a281 to your computer and use it in GitHub Desktop.
Get Video Links (in HD 720p) from CodeSchool
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
//[Steps] | |
//1) Go to your course page => for instance: https://www.codeschool.com/courses/try-elixir/videos | |
//2) Execute the code below | |
//3) Check your console | |
//4) Copy the video links and use them in a download tool you like | |
//[Notes] | |
//- You need to be logged in and have access to the videos (some of them are only available for premium users) | |
//- The output (in your console) is a huge stringified JSON. Use it to download your videos with any tool you like (wget, curl, aria2, etc.) | |
//- You can make use of some extensions that can inject JS in a page (like 'cjs') | |
(function() { | |
const content = Array.from(document.querySelectorAll('script')).filter(script => /CS\.Classes\.VideoManager/.test(script.text))[0].text; | |
const regex = /CS\.Classes\.VideoManager\((\{.+\})\);\s*\}\);/; | |
const [_, json] = content.match(regex); | |
const obj = JSON.parse(json); | |
const media = obj.media.map(media => ({ | |
title: media.title, | |
link: media.media.replace('/data.json?', '.mp4?profile=720p&') | |
})); | |
console.log(media); | |
console.dir(JSON.stringify(media)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment