Created
January 15, 2009 01:16
-
-
Save mattn/47205 to your computer and use it in GitHub Desktop.
This file contains 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
use strict; | |
use warnings; | |
use URI; | |
use Web::Scraper; | |
use YAML; | |
my $staff = scraper { | |
process '//table[@width="565" and descendant::a[contains(@href,".asx")] ]', 'entries[]' => scraper { | |
process 'td.main_title2 > p', title => 'TEXT'; | |
process '//table[@width="553"]//td[@class="main_txt1"]', body => 'TEXT'; | |
process 'td.main_txt2', date => 'TEXT'; | |
process '//a[contains(@href, ".asx")]', enclosure => [ '@href', | |
sub { +{ url => $_, type => 'video/x-ms-asf' } } ]; | |
process '//a[contains(@href, ".asx")]', link => '@href'; | |
}; | |
process 'title', title => 'TEXT'; | |
process 'span.main_title3 > strong > img', image => ['@src', sub { +{ url => $_} } ]; | |
process '//table[@width="573"]//td[@class="main_txt1"]', 'description' => 'TEXT'; | |
}; | |
warn Dump $staff->scrape( URI->new("http://www.animate.tv/digital/web_radio/detail_104.html") ); | |
warn Dump $staff->scrape( URI->new("http://www.animate.tv/digital/web_radio/detail_104.html") ); | |
#warn Dump $staff->scrape( URI->new("http://www.animate.tv/digital/web_radio/detail_106.html") ); # 404 video not found | |
warn Dump $staff->scrape( URI->new("http://www.animate.tv/digital/web_radio/detail_107.html") ); | |
warn Dump $staff->scrape( URI->new("http://www.animate.tv/digital/web_radio/detail_108.html") ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment