Skip to content

Instantly share code, notes, and snippets.

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/49600 to your computer and use it in GitHub Desktop.
Save otsune/49600 to your computer and use it in GitHub Desktop.
From d88c2b2cc0004587fcf04f485d6cf5a8b61240f4 Mon Sep 17 00:00:00 2001
From: Masafumi Otsune <info@otsune.com>
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