Created
September 4, 2021 18:34
-
-
Save MatthewCash/43a778d75db828a3b34f065060e6d08a to your computer and use it in GitHub Desktop.
Download Pearson Textbook PNGs
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
// Edit the 2 values below and run in browser console | |
const bookUrl = 'https://plus.pearson.com/eplayer/pdfassets/prod1/XXXXXXX/UUIDXXXXXXXXXXX' | |
const lastPageNum = 1431; | |
const download = (filename, url) => { | |
const element = document.createElement('a'); | |
element.setAttribute('href', url); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); | |
} | |
for (let i = 0; i <= lastPageNum; i++) { | |
const image = await fetch(`${bookUrl}/pages/page${i}?password=&accessToken=null&formMode=true`).then(res => res.blob()); | |
download(i + ".png", URL.createObjectURL(image)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment