Re:Coursera shuts access to old platform courses
by raybb on Sunday June 12, 2016 @12:55AM
(#11886705)
If you go the page where all your archived courses are and run this code it'll give you a list of the slugs :)
//////////Grab archived urls
var archived = document.getElementsByClassName("link-button primary");
var archivedUrls = [];
var slugs = [];
for (var i = 0; i < archived.length; i++){
archivedUrls.push(document.getElementsByClassName("link-button primary")[i].href);
}
//////////////////////////////
function getDatas(LLL){
$.ajax({
url: LLL,
dataType: 'text',
success: function (data) {
var re = /F[a-zA-Z0-9-]*-0\d{2}/;
var info = data.match(re)[0];
var fixeInfo = info.substring(1);
slugs.push(fixeInfo);
console.log(fixeInfo);
}
});
}
var ii = 0; // set your counter to 1
function myLoop () { // create a loop function
setTimeout(function () { // call a 3s setTimeout when the loop is called
console.log(archivedUrls[ii]);
getDatas(archivedUrls[ii]);
ii++; // increment the counter
if (ii < archivedUrls.length) { // if the counter < 10, call the loop function
myLoop(); // .. again which will trigger another
} else {
console.log('Type "slugs" to view all slugs gathered');
}
}, 1000)
}
//////////Grab archived urls
var archived = document.getElementsByClassName("link-button primary"); var archivedUrls = []; var slugs = []; for (var i = 0; i < archived.length; i++){ archivedUrls.push(document.getElementsByClassName("link-button primary")[i].href); } //////////////////////////////
var ii = 0; // set your counter to 1function myLoop () { // create a loop function setTimeout(function () { // call a 3s setTimeout when the loop is called console.log(archivedUrls[ii]); getDatas(archivedUrls[ii]); ii++; // increment the counter if (ii < archivedUrls.length) { // if the counter < 10, call the loop function myLoop(); // .. again which will trigger another } else { console.log('Type "slugs" to view all slugs gathered'); } }, 1000) }
myLoop(); // start the loop