Created
March 2, 2022 01:20
-
-
Save william-reed/b0687cb91a2e69c920c1d737eb68fc36 to your computer and use it in GitHub Desktop.
erwin.vw.com download all documents
This file contains 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
// once you have a one day plan: | |
// 1. navigate to your vehicles page under 'Service Information' | |
// 2. Leave 'Category 1' set to '[Category 1]' and click search | |
// 3. Open your JS console | |
// get all document titles | |
titles = document.getElementsByClassName("title") | |
documentIds = [] | |
// extract each document id | |
for (let title of titles) { | |
documentIds.push(title.href.split("=")[1]) | |
} | |
// function to download target URL | |
function download(url, filename) { | |
fetch(url).then(function(t) { | |
return t.blob().then((b)=>{ | |
var a = document.createElement("a"); | |
a.href = URL.createObjectURL(b); | |
a.setAttribute("download", filename); | |
a.click(); | |
} | |
); | |
}); | |
} | |
// download them all | |
documentIds.forEach { docId => | |
download("https://erwin.vw.com/erwin/onlineview.sealed?articleId=" + docId, docId) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment