Skip to content

Instantly share code, notes, and snippets.

@ElnuDev
Created February 20, 2022 23:04
Show Gist options
  • Save ElnuDev/32f49e5d254f0c7e89cbb963514cdef1 to your computer and use it in GitHub Desktop.
Save ElnuDev/32f49e5d254f0c7e89cbb963514cdef1 to your computer and use it in GitHub Desktop.
NextRequest Downloader
// ==UserScript==
// @name NextRequest Downloader
// @version 1
// @grant none
// ==/UserScript==
let downloadButton = document.createElement("button");
downloadButton.innerHTML = "Download all";
downloadButton.style.position = "absolute";
downloadButton.style.top = "8px";
downloadButton.style.left = "8px";
downloadButton.style.zIndex = 999;
document.body.append(downloadButton);
downloadButton.onclick = () => {
downloadButton.innerHTML = "Working on it...";
document.querySelectorAll("a").forEach(element => {
if (element.title != "Show/hide contents") {
return;
}
element.click();
});
// Wait for one second for expanded contents to load in
setTimeout(() => {
document.querySelectorAll("a").forEach(element => {
if (!element.href.endsWith("/download")) {
return;
}
window.open(element.href, "_blank");
});
}, 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment