Skip to content

Instantly share code, notes, and snippets.

@kga
Created Jun 13, 2009
Embed
What would you like to do?
#!/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