Skip to content

Instantly share code, notes, and snippets.

@otsune
Created January 11, 2009 11:52
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 otsune/45695 to your computer and use it in GitHub Desktop.
Save otsune/45695 to your computer and use it in GitHub Desktop.
#!/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