Skip to content

Instantly share code, notes, and snippets.

@SpaceSaver
Created April 23, 2023 21:54
Show Gist options
  • Save SpaceSaver/b9fb7f896877076743ba9676408abb96 to your computer and use it in GitHub Desktop.
Save SpaceSaver/b9fb7f896877076743ba9676408abb96 to your computer and use it in GitHub Desktop.
Code for saving all ChromeOS images on page at Chrome100.dev to the Web Archive Wayback Machine
function saveToWA(linkurl){
const form = document.createElement('form');
form.setAttribute("method", "POST");
form.setAttribute("action", "https://web.archive.org/save/" + linkurl);
form.id = "theForm";
const urlbox = document.createElement("input");
urlbox.id = "chromeurl";
urlbox.setAttribute("name", "url");
urlbox.value = linkurl;
form.appendChild(urlbox);
const subbutt = document.createElement("button");
subbutt.id = "yass";
subbutt.textContent = "Go";
form.appendChild(subbutt);
document.body.appendChild(form);
subbutt.dispatchEvent(new MouseEvent("click", {ctrlKey: true}));
form.remove();
}
function goAll (){
const images = __NEXT_DATA__.props.pageProps.images;
let x = 0;
let crazyint = setInterval(() => {
let image = 0;
if (x < images.length) {
image = images[x]
x++
} else {
clearInterval(crazyint);
return;
}
const url = `https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_${image.platform}_${image.board}_recovery_${image.channel}_${image.mp_token}${image.mp_key != 1 ? "-v" + image.mp_key : ""}.bin.zip`
console.log(url);
saveToWA(url);
}, 1000);
}
goAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment