Skip to content

Instantly share code, notes, and snippets.

@leedo
Created April 27, 2011 16:12
Show Gist options
  • Save leedo/944561 to your computer and use it in GitHub Desktop.
Save leedo/944561 to your computer and use it in GitHub Desktop.
1 #!/usr/bin/perl
2 use AnyEvent::Feed;
3
4 my @image_urls;
5 my $img_re = qr{https?://[^\s]+\.(?:gif|png|jpe?g)}i;
6
7 my $feed = AnyEvent::Feed->new(
8 url => 'http://cutegirlsbeingcute.tumblr.com/rss',
9 interval => 60 * 60, # every hour
10 on_fetch => sub {
11 my ($reader, $new, $feed, $error) = @_;
12 @image_urls = map {($_->content->body =~ /($img_re)/g)} $feed->entries;
13 },
14 );
15
16 AE::cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment