Skip to content

Instantly share code, notes, and snippets.

@Windows81
Created May 10, 2026 04:28
Show Gist options
  • Select an option

  • Save Windows81/1cc9bfaaacc43ba84ce074e034e363da to your computer and use it in GitHub Desktop.

Select an option

Save Windows81/1cc9bfaaacc43ba84ce074e034e363da to your computer and use it in GitHub Desktop.
Run this script on a Canvas course page (https://csufullerton.instructure.com/courses/[0-9]+) to retrieve a list of hotlinks to downloadable files.
function downloadURI(url, name) {
var link = document.createElement("a");
link.download = name;
link.href = url;
link.click();
}
let elements = document.querySelectorAll(".attachment");
elements.forEach((e) => {
let url = document.location + "/files/" + e.className.match(/Attachment_(\d+)/)[1] + "/download?download_frd=1";
let name = e.querySelector("a").title;
console.log(url);
downloadURI(url, name);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment