Lifehacker, tips and downloads for getting things done
http://m.lifehacker.com//5774707/download-the-entire-archive-of-nasas-astronomy-picture-of-the-day-with-one-command
Lifehacker, tips and downloads for getting things done
Nasa's Astronomy Picture of the Day archive is a packed with awe-inspiring, high-resolution images of space that, incidentally, work great as desktop wallpapers. But NASA doesn't offer an easy way to grab everything. Command-line tool wget to the rescue!
Update: This post is primarliy meant as a good example of how you can use wget to save time, but if all you want is the images, I put together this torrent. Enjoy!
A little backstory: My wife is a graphic designer working on a project related to the Griffith Park Observatory here in Los Angeles. She was looking for high-res images of space, and I knew Nasa's APOD archive was full of great images—but grabbing them all isn't easy, and clicking through the archive is tedious. So I turned to wget, a cross-platform command line tool.
Windows users, you can grab wget from here; Mac users, here's a good one for you. (Follow the installation instructions in the download.) Linux users should have it installed by default. Assuming you've got wget installed, open your command line, then cd
to a folder you want to store them in (I've got mine in a folder on my capacious Media drive called wgot
. The command for downloading the archives is simple:
wget -r -l2 -t1 -nd -N -np -w2 -A.jpg -erobots=off http://apod.nasa.gov/apod/archivepix.html
This command will crawl the archive page, follow any links, and eventually start downloading only the JPG files in the domain. The -w2 option adds a two-second wait between each ping—something I didn't include when I did it, but… I also don't want us to absolutely kill their servers, so hopefully that will help.
Everything downloaded takes up about 2.64GB on my drive, and you'll end up with a few low-quality dupes of the higher quality stuff, but you can easily sort by size and get rid of some of the lower resolution stuff. We published a wget primer some five years ago, so if this use case gets you interested in what else wget is capable of, give the old post a read. Also: I'm a wget dabbler, so if you've got any improvements, let's hear them in the comments.
You can contact Adam Pash, the author of this post, at tips+adam@lifehacker.com. You can also follow him on Twitter and Facebook.
(via Instapaper)
Jay Elkes
No comments:
Post a Comment