Skip to content

Instantly share code, notes, and snippets.

@Tobiaqs
Created May 8, 2017 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tobiaqs/5d20e52cf803e259f12a83d16168a501 to your computer and use it in GitHub Desktop.
Save Tobiaqs/5d20e52cf803e259f12a83d16168a501 to your computer and use it in GitHub Desktop.
A script that leeches video files off of the TU/e's videocollege site. This is useful when you don't have a Windows PC, and hence can't use the site.
(function () {
let payload = {
getPlayerOptionsRequest: {
ResourceId: location.pathname.split('/').reverse()[0],
QueryString: location.search,
UseScreenReader: false,
UrlReferrer: document.referrer
}
};
fetch("/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload),
credentials: "include"
}).then((response) => {
return response.json();
}, (error) => {
alert("An error occurred. See console for details.");
console.log(error);
}).then((json) => {
if (!json || !json.d || !json.d.Presentation || !json.d.Presentation.Streams) {
alert("Unusable data received. See console for a dump.");
console.log(json);
return;
}
let stream = json.d.Presentation.Streams.find((stream) => {
return stream.VideoUrls.length > 0;
});
if (!stream) {
alert("No video stream found.");
return;
}
let a = document.createElement('A');
a.download = json.d.Presentation.Title;
a.href = stream.VideoUrls[0].Location;
a.click();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment