Created
December 19, 2017 21:55
-
-
Save UnluckyNinja/187029f68906f2c6df8c6e6924547ae4 to your computer and use it in GitHub Desktop.
http://www.jeffersoncheng.com/Anonymous-Animals Base on https://gist.github.com/rockwotj/6a356a95732985b09e2b
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
@Grab(group='commons-io', module='commons-io', version='2.4') | |
import org.apache.commons.io.FilenameUtils | |
def icons = ['alligator', 'anteater', 'armadillo', 'auroch', 'axolotl', 'badger', 'bat', 'bear', 'beaver', 'buffalo', 'camel', 'capybara', 'chameleon', 'cheetah', 'chinchilla', 'chipmunk', 'chupacabra', 'cormorant', 'coyote', 'crow', 'dingo', 'dinosaur', 'dog', 'dolphin', 'duck', 'elephant', 'ferret', 'fox', 'frog', 'giraffe', 'gopher', 'grizzly', 'hedgehog', 'hippo', 'hyena', 'ibex', 'ifrit', 'iguana', 'jackal', 'kangaroo', 'koala', 'kraken', 'lemur', 'leopard', 'liger', 'lion', 'llama', 'slow loris', 'manatee', 'mink', 'monkey', 'moose', 'narwhal', 'nyan cat', 'orangutan', 'otter', 'panda', 'penguin', 'platypus', 'pumpkin', 'python', 'quagga', 'rabbit', 'raccoon', 'rhino', 'sheep', 'shrew', 'skunk', 'squirrel', 'tiger', 'turtle', 'walrus', 'wolf', 'wolverine', 'wombat'] | |
def url = 'https://ssl.gstatic.com/docs/common/profile/$$_lg.png' | |
def urls = icons.collect{ | |
url.replace('$$',it.replace(' ','')).toURL() | |
} | |
urls.each{ | |
def filename = FilenameUtils.getName(it.file) | |
def file = new File(filename) | |
if(!file.exists()){ | |
file.createNewFile() | |
}else{ | |
return | |
} | |
try{ | |
file.withOutputStream{ fileoutput -> | |
it.withInputStream{ urlinput -> | |
fileoutput << urlinput | |
} | |
} | |
}catch(e){ | |
println "$filename failed" | |
return | |
} | |
println "finished $filename" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment