Created
November 13, 2010 16:09
-
-
Save gslin/675447 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/perl | |
use AnyEvent::HTTP; | |
use EV; | |
use JSON; | |
use strict; | |
use warnings; | |
use constant APIBASE => 'http://emma.pixnet.cc'; | |
main(); | |
sub grubSets | |
{ | |
my $user = shift; | |
my $setId = shift; | |
http_get APIBASE . "/album/elements?set_id=$setId&user=$user", sub { | |
my $jsonRaw = shift; | |
my $jsonObj = JSON::from_json($jsonRaw) or return; | |
foreach my $element (@{$jsonObj->{elements}}) { | |
my $url = $element->{thumb}; | |
http_get $url, sub { | |
print "$url\n"; | |
}; | |
} | |
}; | |
} | |
sub grubUser | |
{ | |
my $user = shift; | |
http_get APIBASE . "/album/sets?user=$user", sub { | |
my $jsonRaw = shift; | |
my $jsonObj = JSON::from_json($jsonRaw) or return; | |
foreach my $set (@{$jsonObj->{sets}}) { | |
grubSets($user, $set->{id}); | |
} | |
}; | |
} | |
sub main | |
{ | |
my $user = 'raindog'; | |
grubUser($user); | |
EV::loop; | |
} | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment