Download multiple images using javascript script
As an developer, we might need to download bulk images from any website. We won’t like to download 50 images one by one. It will waste a lot of time.
What we can do, we can write a small script and run it in browser developer tool console and get bulk images download within in seconds.
Here is how you can use a script to get bulk images from any website. Use below this script in your developer tool console.
For example, if you want to download images from https://testing-images.com/images-1.jpg to https://testing-images/images-50.jpg, Then go to https://testing-images.com website and open developer tools and go to console and run below script.
for(let i=1; i<=50; i++){
setTimeout(() => {
fetch(`https://testing-images/images-${i}.jpg`)
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
// the filename you want
a.download = `slide-mian-${i}.jpg`;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
})
.catch(() => alert('oh no!'));
}, i*1000);
}
We are done :)