Created
December 8, 2015 13:32
-
-
Save craftoid/5fd3389db3b0f517a9cf to your computer and use it in GitHub Desktop.
a litte script to download and view the images of the fantastic Vera Molnar without flash...
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
// a litte script to download and view the images | |
// of the fantastic Vera Molnar without flash... | |
String domain = "http://www.veramolnar.com"; | |
String output = "images"; | |
for (int year = 1939; year <= 2012; year++) { | |
// download xml file | |
String[] lines = loadStrings(domain + "/xml/" + year + ".xml"); | |
// drop the first line, it may be malformed | |
lines[0] = ""; | |
// fix ampersands | |
String data = join(lines, "\n").replaceAll("&", "&"); | |
// parse it! | |
XML xml = parseXML(data); | |
// get list of images | |
XML[] images = xml.getChildren("image"); | |
// download the images | |
for (XML image : images) { | |
// extract url and filename | |
String url = domain + "/" + image.getString("fichier"); | |
String[] parts = split(url, "/"); | |
String filename = output + "/" + parts[parts.length - 1]; | |
// now, download the image and save it | |
println("Downloading " + url); | |
saveBytes(filename, loadBytes(url)); | |
} | |
} | |
println("done."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment