Squid Fingers v2

| | Comments (1)

I wanted to change my twitter background image yesterday and recalled how much I love the background images over at squidfingers.

As can be expected, the site was redesigned at some point in the past 3'ish years. The redesign broke my script as the image names/locations changed.

The newly modified perl script can be found here.

#!/usr/bin/perl
use strict;
use LWP::Simple 'getstore';

# squidfingers.pl - will willis - 05/28/2008
# a script to download groovy background images like:
# http://squidfingers.com/assets/patterns/pattern_028.gif

my $count = 1; # to iterate over images
my $error = 0; # count failed requests
my $give_up = 5; # when we've probably run out of images

while (1) {
download_bg($count) || $error++;
last if $error > $give_up;
$count++;
}

sub download_bg {
my $num = sprintf("%03d",shift);
my $url = "http://squidfingers.com/assets/patterns/pattern_$num.gif";
my $response = getstore($url,"$num.gif");
return ($response eq '200') ? 1 : 0;
}

1 Comments

Chris said:

Look Ma, one line!


curl -fO "http://squidfingers.com/assets/patterns/pattern_[001-999].gif"

Gotta love curl.


Leave a comment

About this Entry

This page contains a single entry by Will published on May 29, 2008 9:16 AM.

Search Frenzy was the previous entry in this blog.

Don't Make Me Think v. Think for Me is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01
Support this site by opening up a hosting account with site5.com
Powered By Site5.com