Skip to content

Instantly share code, notes, and snippets.

Last active Dec 20, 2015
What would you like to do?
Steps for bulk downloading NASA Apollo images in the public domain.
// 0. open url:
// (n.b. all images to be downloaded are in the public domain)
// 1. install jquery by running this snippet in the console:
var s = document.createElement('script');
s.src = '';
(document.getElementsByTagName('head')[0] ||
// 2. click on an index page and run this to generate a list of image links:
var urlA = [];
$('a', frames.itemlist.document.getElementsByTagName('html')).each(function() {
var ids = this.href.match(/disptn\('(\d+)','(.+)'\)/);
if (ids) {
urlA.push('' +
ids[1] + "&imageID=" + ids[2]);
var dl = window.setInterval(function() {
if (!urlA.length) {
$.get(urlA.pop()).done(function(d) {
console.log($('table', d).find('a').last().get(0).href); // last url is best res
}, 2000); // site-enforced rate limit
// 3. paste list of links into a file named images.txt and run:
// $ wget -i images.txt
// (you may need to install wget via `brew install wget` first;
// if you don't have homebrew installed, get it here:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment