A naively implemented script for exporting files posted on Google Classrooms streams
- Open the Google Classroom stream in your browser
- Scroll down to the bottom of the page to load all the posts
- Open the browser console (F12) and paste the following code:
Array.from(document.querySelectorAll("a"))
.filter((a) => a.getAttribute("aria-label") ?? "".startsWith("Attachment:"))
.map((a) => {
const url = a.getAttribute("href");
if (!URL.canParse(url)) {
return null;
}
return { link: url, title: a.getAttribute("title") };
})
.filter((a) => a !== null && a.title !== null);
- Save the output to a JSON file
- Run the download script:
bun run ./index.ts <path-to-json-file> <output-directory>