Created
January 11, 2009 11:52
-
-
Save otsune/45695 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 strict; | |
use warnings; | |
use Web::Scraper; | |
use URI; | |
#my $stage = shift || ''; | |
my $uri = URI->new( "http://www.jp.playstation.com/psworld/movie/" ); | |
my $res = scraper { | |
process '//tr[td[@class="mplayarea" and ./a[contains(@href, ".asx")]]]', 'entries[]' => scraper { | |
process 'td.txtarea > h3', title => 'TEXT', | |
process 'p.moviedata', body => 'TEXT', | |
process '//a[contains(@href,".asx")]', video => '@href', | |
process 'img.pborder', thumbnail => sub { URI->new_abs( $_->attr('src'), $uri ) }, | |
}; | |
process 'title', title => 'TEXT'; | |
result qw/entries title/; | |
}->scrape( $uri ); | |
my $feed = { | |
title => $res->{title}, | |
link => $uri->as_string, | |
}; | |
for my $entry (@{$res->{entries}}) { | |
push @{$feed->{entries}}, { | |
title => $entry->{title}, | |
link => $uri->as_string, | |
body => $entry->{body}, | |
enclosure => { url => $entry->{video}, type => 'video/x-ms-asf', }, | |
thumbnail => { url => $entry->{thumbnail}, }, | |
}; | |
} | |
use YAML; | |
binmode STDOUT, ":utf8"; | |
print Dump $feed; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment