Adds a check about the item author and a backup if one is not there. Tidied up some CSS
This commit is contained in:
parent
cf59c9248d
commit
38400c7b82
35
smhnRSS.pl
35
smhnRSS.pl
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
use cPanelUserConfig; #for cpanel servers
|
# use cPanelUserConfig; #for cpanel servers
|
||||||
|
|
||||||
use 5.010;
|
use 5.010;
|
||||||
use strict;
|
use strict;
|
||||||
@ -63,6 +63,7 @@ my %list;
|
|||||||
# Make the list of URLS while parsing DATA
|
# Make the list of URLS while parsing DATA
|
||||||
my $listHTML = "<div class=\'listHTML\'><ul>\n";
|
my $listHTML = "<div class=\'listHTML\'><ul>\n";
|
||||||
|
|
||||||
|
# Go through each URL in the DATA section and make the new list
|
||||||
while ( my $url = <DATA>) {
|
while ( my $url = <DATA>) {
|
||||||
chomp $url;
|
chomp $url;
|
||||||
|
|
||||||
@ -96,6 +97,15 @@ while ( my $url = <DATA>) {
|
|||||||
$testItem->{'feedURL'} = $_;
|
$testItem->{'feedURL'} = $_;
|
||||||
$testItem->{'feedName'} = $rss1->{'channel'}{'title'};
|
$testItem->{'feedName'} = $rss1->{'channel'}{'title'};
|
||||||
|
|
||||||
|
# Find Author tags
|
||||||
|
if ($testItem->{'dc'}{'creator'}) {
|
||||||
|
$testItem->{'itemAuthor'} = $testItem->{'dc'}{'creator'};
|
||||||
|
} elsif ($testItem->{'author'}) {
|
||||||
|
$testItem->{'itemAuthor'} = $testItem->{'author'}
|
||||||
|
} else {
|
||||||
|
$testItem->{'itemAuthor'} = $rss1->{'channel'}{'title'};
|
||||||
|
} # if author
|
||||||
|
|
||||||
# Clean up some of the artifacts in the RSS feed 'description' section
|
# Clean up some of the artifacts in the RSS feed 'description' section
|
||||||
$testItem->{'description'} =~ s/\n\s*/\n/g; # get rid of excess white space
|
$testItem->{'description'} =~ s/\n\s*/\n/g; # get rid of excess white space
|
||||||
$testItem->{'description'} =~ s/(<a(.+?)<\/a>)$//s; # link at end of description
|
$testItem->{'description'} =~ s/(<a(.+?)<\/a>)$//s; # link at end of description
|
||||||
@ -151,7 +161,7 @@ foreach my $name (reverse sort keys %list) {
|
|||||||
link => $list{$name}->{'link'},
|
link => $list{$name}->{'link'},
|
||||||
description => $list{$name}->{'description'},
|
description => $list{$name}->{'description'},
|
||||||
pubDate => $list{$name}->{'pubDate'},
|
pubDate => $list{$name}->{'pubDate'},
|
||||||
author => $list{$name}->{'dc'}{'creator'},
|
author => $list{$name}->{'itemAuthor'},
|
||||||
source => $list{$name}->{'feedName'},
|
source => $list{$name}->{'feedName'},
|
||||||
sourceUrl => $list{$name}->{'feedURL'},
|
sourceUrl => $list{$name}->{'feedURL'},
|
||||||
); # $rss->channel
|
); # $rss->channel
|
||||||
@ -204,9 +214,7 @@ my $html = <<"HTML_END";
|
|||||||
body{
|
body{
|
||||||
margin:40px auto;
|
margin:40px auto;
|
||||||
max-width:650px;
|
max-width:650px;
|
||||||
line-height:1.6;
|
font: 18px/1.6 baskerville, palatino, 'palatino linotype', georgia,serif;
|
||||||
font-size:18px;
|
|
||||||
font-family: Baskerville, TimesNewRoman, Times New Roman, Times, Georgia, serif;
|
|
||||||
padding:0 10px:
|
padding:0 10px:
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
@ -239,7 +247,7 @@ my $html = <<"HTML_END";
|
|||||||
|
|
||||||
<h1>$title</h1>
|
<h1>$title</h1>
|
||||||
<p>$description</p>
|
<p>$description</p>
|
||||||
<p>This site is updated every Sunday morning</p>
|
<p>This site is in BETA and will update daily as we test things out and add URLs. Let us know if there are sites that should be included!</p>
|
||||||
<p>updated: $printDate</p>
|
<p>updated: $printDate</p>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
@ -305,12 +313,13 @@ close(FH);
|
|||||||
###################################
|
###################################
|
||||||
|
|
||||||
sub formatDate {
|
sub formatDate {
|
||||||
|
# takes a date, and converts it to a formatted string
|
||||||
my $testDate = $_[0];
|
my $testDate = $_[0];
|
||||||
$testDate =~ s/((\+|\-)(\d\d\d\d))//;
|
$testDate =~ s/((\+|\-)(\d\d\d\d))//;
|
||||||
# Convert to a TIME object
|
# Convert to a TIME object
|
||||||
my $t = Time::Piece->strptime($testDate);
|
my $t = Time::Piece->strptime($testDate);
|
||||||
return($t->strftime('%a, %d %b %Y %H:%M:%S'));
|
return($t->strftime('%a, %d %b %Y %H:%M:%S'));
|
||||||
}
|
} # sub formatDate
|
||||||
|
|
||||||
# FIN
|
# FIN
|
||||||
|
|
||||||
@ -326,10 +335,10 @@ https://kelliowen.com/feed/
|
|||||||
https://mercedesmyardley.com/feed/
|
https://mercedesmyardley.com/feed/
|
||||||
https://mehitobel.com/feed/
|
https://mehitobel.com/feed/
|
||||||
http://antoncancre.blogspot.com/feeds/posts/default?alt=rss
|
http://antoncancre.blogspot.com/feeds/posts/default?alt=rss
|
||||||
|
https://marysangi.wordpress.com/feed/
|
||||||
https://www.toddkeisling.com/news?format=rss
|
https://www.toddkeisling.com/news?format=rss
|
||||||
https://www.jfgonzalez.org/news?format=rss
|
https://www.jfgonzalez.org/news?format=rss
|
||||||
https://www.briankeene.com/news?format=rss
|
https://www.briankeene.com/news?format=rss
|
||||||
https://ghoulish.rip/feed/
|
|
||||||
https://www.cemeterydance.com/extras/feed/
|
https://www.cemeterydance.com/extras/feed/
|
||||||
https://www.gwendolynkiste.com/Blog/feed/
|
https://www.gwendolynkiste.com/Blog/feed/
|
||||||
https://katherinesilvaauthor.substack.com/feed
|
https://katherinesilvaauthor.substack.com/feed
|
||||||
@ -339,3 +348,13 @@ http://jacobhaddon.com/feed/
|
|||||||
http://apokrupha.com/feed/
|
http://apokrupha.com/feed/
|
||||||
https://ellendatlow.com/feed/
|
https://ellendatlow.com/feed/
|
||||||
https://paulaguran.com/
|
https://paulaguran.com/
|
||||||
|
https://amandaheadlee.com/feed/
|
||||||
|
https://theimbloglio.wordpress.com/feed/
|
||||||
|
https://kennethwcain.com/feed/
|
||||||
|
https://wellwortharead.blogspot.com/feeds/posts/default?alt=rss
|
||||||
|
http://robertfordauthor.com/feed/
|
||||||
|
https://tinyfrights.com/feed/
|
||||||
|
https://weightlessbooks.com/feed/
|
||||||
|
https://www.crystallakepub.com/feed/
|
||||||
|
https://lynnehansen.zenfolio.com/blog.rss
|
||||||
|
https://www.bevvincent.com/feed/
|
Loading…
x
Reference in New Issue
Block a user