Skip to content

Instantly share code, notes, and snippets.

@MatthewCash
Created September 4, 2021 18:34
Show Gist options
  • Save MatthewCash/43a778d75db828a3b34f065060e6d08a to your computer and use it in GitHub Desktop.
Save MatthewCash/43a778d75db828a3b34f065060e6d08a to your computer and use it in GitHub Desktop.
Download Pearson Textbook PNGs
// 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