-
-
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.
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
| 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