-
-
Save josenaves/6015808 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
Instructions: | |
1. Log in with your account and go to the desired course | |
2. Open the courseware tab | |
3. Configure the week variable | |
4. Copy this code and paste it in the browser console | |
*/ | |
var week = 1; | |
var urls = []; | |
jQuery('nav ul[role=tabpanel]:eq(' + (week-1) + ') li').each(function() { | |
urls.push(jQuery(this).find('a').attr('href')); | |
}); | |
var codes = []; | |
var regex = /data-streams="1.0:(.*?)"/gi, result; | |
jQuery.each(urls, function (index, value) { | |
jQuery.ajax(value, { | |
'async': false, | |
'dataType': 'html', | |
'success': function(data) { | |
while ( (result = regex.exec(data)) ) | |
{ | |
codes.push(result[1]); | |
} | |
} | |
}); | |
// return false; // break bucle | |
}); | |
jQuery.each(codes, function(index, value) { | |
console.log('youtube-dl --write-sub http://www.youtube.com/watch?v=' + value); | |
}); | |
console.log('Number of videos in the week ' + week + ': ' + codes.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment