Created
January 20, 2009 18:52
-
-
Save otsune/49600 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
From d88c2b2cc0004587fcf04f485d6cf5a8b61240f4 Mon Sep 17 00:00:00 2001 | |
From: Masafumi Otsune <[email protected]> | |
Date: Wed, 21 Jan 2009 03:51:36 +0900 | |
Subject: [PATCH] Add scraper for Macross Frontier Web Radio | |
--- | |
root/plugins/macrossf.com/scraper.pl | 27 +++++++++++++++++++++++++++ | |
1 files changed, 27 insertions(+), 0 deletions(-) | |
create mode 100644 root/plugins/macrossf.com/scraper.pl | |
diff --git a/root/plugins/macrossf.com/scraper.pl b/root/plugins/macrossf.com/scraper.pl | |
new file mode 100644 | |
index 0000000..cacb524 | |
--- /dev/null | |
+++ b/root/plugins/macrossf.com/scraper.pl | |
@@ -0,0 +1,27 @@ | |
+# http://www.macrossf.com/radio/radio.html | |
+sub init { | |
+ my $self = shift; | |
+ $self->{handle} = "/radio/radio.html"; | |
+} | |
+ | |
+sub build_scraper { | |
+ my $i = 0; | |
+ scraper { | |
+ process 'title', title => 'TEXT'; | |
+ process 'dt.clear + dd', description => 'TEXT'; | |
+ process 'dl.clear > dd.onair + dd', 'entries[]' => scraper { | |
+ process 'a', | |
+ link => '@href', | |
+ enclosure => [ '@href', | |
+ sub { +{ url => $_, type => 'video/x-ms-asf' } } ]; | |
+ process 'a>img', | |
+ thumbnail => '@src'; | |
+ }; | |
+ process 'dl.clear > dd.onair', sub { | |
+ result->{entries}->[$i]->{title} = $_->as_text; | |
+ $i++; | |
+ }; | |
+ result->{thumbnail} = URI->new('http://macrossf.com/image/radio/logo_radio.jpg'); | |
+ result; | |
+ }; | |
+} | |
-- | |
1.6.0.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment