Last active
November 23, 2017 20:05
-
-
Save macabreb0b/35aa9c7b715635f2fa21 to your computer and use it in GitHub Desktop.
Download pngs of the first 151 Pokemon from pokemon.com
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
// 1. Go to pokemon.com/us/pokedex | |
// 2. Copy + paste script into the console to reveal n pokemon and download their png source files. | |
// * change 151 to whatever number you like to download more / less pokemon. | |
var figures, | |
n = 151, | |
currentLength = 0; | |
loadMore.click(); | |
var downloadImages = function() { | |
var i=0; | |
while(i < n) { | |
var a = $('<a>'); | |
var pokeLink = $(figures[i]).find('img').attr('src'); | |
a.attr('href', pokeLink).attr('download', 'poke.png').appendTo('body');a[0].click();a.remove();i += 1; | |
} | |
} | |
var expandPage = setInterval(function() { | |
figures = $('figure'); | |
if (figures.length === currentLength) return; | |
currentLength = figures.length; | |
if(figures.length < n) { | |
window.scrollTo(0,document.body.scrollHeight); | |
} else { | |
clearInterval(expandPage); | |
downloadImages(); | |
} | |
}, 300); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment