Skip to content

Instantly share code, notes, and snippets.

@doug
Last active August 29, 2015 14:03
Show Gist options
  • Save doug/ee7259689978ee16eece to your computer and use it in GitHub Desktop.
Save doug/ee7259689978ee16eece to your computer and use it in GitHub Desktop.
download all the images matching a regex on a page
function download(i) {
var link = document.createElement('a');
link.href = i.src;
link.download = '';
link.click();
}
Array.prototype.slice.call(document.querySelectorAll('img')).filter(
function(i){return !!i.src.match(/.*\.gif$/)}).forEach(download);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment