Skip to content

Instantly share code, notes, and snippets.

@kga
Created June 13, 2009 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kga/129236 to your computer and use it in GitHub Desktop.
Save kga/129236 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Encode;
use XML::Simple;
use LWP::Simple;
my @id = qw/to sa/;
my @posts = map {
my $feed = XMLin(get("http://$_.tumblr.com/api/read?type=regular&num=50"));
values %{$feed->{posts}{post}};
} @id;
for my $post (sort { $b->{'unix-timestamp'} <=> $a->{'unix-timestamp'} } @posts) {
printf qq{<h2><a href="%s">%s - %s</a></h2>\n<div>%s</div>\n\n},
$post->{url}, $post->{url}, $post->{date}, Encode::encode('utf8', $post->{'regular-body'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment