add some old rss scripts
parent
eaef668c0f
commit
5a7fb5ee2e
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/perl
|
||||
# Generates an RSS feed for the Heroes graphic novels (for use with Liferea etc.)
|
||||
use strict;
|
||||
use LWP::Simple;
|
||||
use XML::RSS;
|
||||
use DateTime;
|
||||
use DateTime::Format::W3CDTF;
|
||||
|
||||
my $MAXCOUNT = 10;
|
||||
|
||||
my $f = DateTime::Format::W3CDTF->new();
|
||||
my $rss = XML::RSS->new(version => '1.0');
|
||||
$rss->channel(
|
||||
title => "Heroes Graphic Novels",
|
||||
link => "http://www.nbc.com/Heroes/novels",
|
||||
description => "",
|
||||
);
|
||||
|
||||
my ($novelNum, $novelPrint, $novelTitle, $novelImg, $novelText, $novelDate);
|
||||
my $i = 0;
|
||||
|
||||
$_ = get("http://www.nbc.com/Heroes/js/novels.js");
|
||||
while (/^(.*)$/gm) {
|
||||
my $line = $1;
|
||||
|
||||
if ($line =~ /case\s+(\d+)\s*:/) {
|
||||
if (defined($novelNum)) {
|
||||
$rss->add_item(
|
||||
title => "$novelNum - $novelTitle",
|
||||
link => $novelPrint,
|
||||
description => "<a href=\"$novelPrint\"><img src=\"$novelImg\" /></a><br/>$novelNum - $novelTitle<br/>$novelText",
|
||||
dc => { date => $novelDate },
|
||||
);
|
||||
last if (++$i >= $MAXCOUNT);
|
||||
}
|
||||
|
||||
$novelNum = $1;
|
||||
}
|
||||
|
||||
#case 2 :
|
||||
# novelImg = "/Heroes/images/novels/novel_002_lg.jpg";
|
||||
# novelTitle = "THE CRANE";
|
||||
# novelText = "To save the world it takes conviction, dedication, and a real Hiro.";
|
||||
# novelPrint = "/Heroes/novels/downloads/Heroes_novel_002.pdf";
|
||||
# novelEgg = "http://www.nbc.com/Heroes/novels/downloads/nathan_line_01.jpg";
|
||||
# libraryImg = "/Heroes/images/novels/novel_002_sm.jpg";
|
||||
# wikiLink = "http://heroeswiki.com/Graphic_Novel:The_Crane";
|
||||
|
||||
if ($line =~ /novelPrint\s*=\s*"(.*)"/) {
|
||||
$novelPrint = "http://www.nbc.com$1";
|
||||
|
||||
my (undef, undef, $modified_time, undef, undef) = head($novelPrint);
|
||||
if (defined($modified_time)) {
|
||||
$novelDate = $f->format_datetime(DateTime->from_epoch(epoch => $modified_time));
|
||||
} else {
|
||||
$novelDate = undef;
|
||||
}
|
||||
}
|
||||
if ($line =~ /novelImg\s*=\s*"(.*)"/) {
|
||||
$novelImg = "http://www.nbc.com$1";
|
||||
}
|
||||
if ($line =~ /novelTitle\s*=\s*"(.*)"/) {
|
||||
$novelTitle = $1;
|
||||
}
|
||||
if ($line =~ /novelText\s*=\s*"(.*)"/) {
|
||||
$novelText = $1;
|
||||
}
|
||||
}
|
||||
|
||||
print $rss->as_string;
|
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/perl
|
||||
# rss-feed für ruthe.de (liferea feed source "command")
|
||||
|
||||
use strict;
|
||||
use LWP::Simple;
|
||||
use XML::RSS;
|
||||
use DateTime;
|
||||
use DateTime::Format::W3CDTF;
|
||||
|
||||
my $f = DateTime::Format::W3CDTF->new();
|
||||
my $rss = XML::RSS->new(version => '1.0');
|
||||
$rss->channel(
|
||||
title => "Ruthe.de",
|
||||
link => "http://www.ruthe.de",
|
||||
description => "Cartoons",
|
||||
);
|
||||
|
||||
$_ = get("http://ruthe.de/frontend/archiv.php");
|
||||
while (m#<a href="index.php\?pic=([0-9]+)&sort=datum&order=DESC"><img src="cartoons/tn_strip_([0-9]+).jpg"#sg) {
|
||||
my ($id, $picid) = ($1, $2);
|
||||
|
||||
my $picurl = "http://ruthe.de/frontend/cartoons/strip_$picid.jpg";
|
||||
my $pagurl = "http://ruthe.de/frontend/index.php?pic=$id&sort=datum&order=DESC";
|
||||
|
||||
my (undef, undef, $modified_time, undef, undef) = head($picurl);
|
||||
my $date = $f->format_datetime(DateTime->from_epoch(epoch => $modified_time));
|
||||
|
||||
$rss->add_item(
|
||||
title => "Comic Nr. $picid",
|
||||
link => $pagurl,
|
||||
description => "<a href=\"$pagurl\"> <img src=\"$picurl\" /> </a>",
|
||||
dc => { date => $date },
|
||||
);
|
||||
}
|
||||
|
||||
print $rss->as_string;
|
Loading…
Reference in New Issue