Created
April 1, 2022 09:46
-
-
Save didier/de1829e84ef0548a21a28ab8b943e51d to your computer and use it in GitHub Desktop.
Download all images from a page
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
const images = document.querySelectorAll('img').forEach((image, index) => { | |
const filename = `${window.location.host}-${index}.jpg` | |
const element = document.createElement('a'); | |
element.setAttribute('href', image.src); | |
element.setAttribute('download', filename); | |
document.body.appendChild(element); | |
element.click(); | |
document.body.removeChild(element); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment