Compare commits
5 Commits
c220728298
...
ecdb015067
Author | SHA1 | Date | |
---|---|---|---|
|
ecdb015067 | ||
|
d30f85b57b | ||
|
38400c7b82 | ||
|
cf59c9248d | ||
|
9340ae6761 |
49
smhnRSS.pl
49
smhnRSS.pl
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
use cPanelUserConfig; #for cpanel servers
|
||||
# use cPanelUserConfig; #for cpanel servers
|
||||
|
||||
use 5.010;
|
||||
use strict;
|
||||
@ -63,6 +63,7 @@ my %list;
|
||||
# Make the list of URLS while parsing DATA
|
||||
my $listHTML = "<div class=\'listHTML\'><ul>\n";
|
||||
|
||||
# Go through each URL in the DATA section and make the new list
|
||||
while ( my $url = <DATA>) {
|
||||
chomp $url;
|
||||
|
||||
@ -96,14 +97,29 @@ while ( my $url = <DATA>) {
|
||||
$testItem->{'feedURL'} = $_;
|
||||
$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
|
||||
$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/<(\w) class=(.*?)>/<$1>/s; # remove class statements from text
|
||||
$testItem->{'description'} =~ s/<figure ((.|\n)+?)figure>//sg; #remove "figure" can use pipe to add more
|
||||
$testItem->{'description'} =~ s/<img(.+?)>//sg; # remove IMG tags
|
||||
$testItem->{'description'} =~ s/<span ((.|\n)+?)>//sg; #remove "span" tags (mostly blogger)
|
||||
$testItem->{'description'} =~ s/<\/span>//sg; #remove "span" endtags
|
||||
$testItem->{'description'} =~ s/<div class="separator" style(.+?)<\/div>//sg; # remove blogger DIV tags
|
||||
$testItem->{'description'} =~ s/<br(.+?)>/<br>/sg; # remove blogger BR tags
|
||||
$testItem->{'description'} =~ s/(<div><br><\/div>)+/<br>/sg; # remove blogger BR + DIV tags
|
||||
$testItem->{'description'} =~ s/.{1200}\K.*//s; # limit length
|
||||
$testItem->{'description'} =~ s/(<[^<]+)$//s; # link at end of description
|
||||
$testItem->{'description'} =~ s/<\/?div.*?>//sg; # remove div tags
|
||||
$testItem->{'description'} =~ s/(<a[^<]+)$//s; # link at end of description
|
||||
|
||||
#add continue reading to end.
|
||||
$testItem->{'description'} .= " <a href=\'" . $testItem->{'link'} . "\' target=\'_blank\'>Continue Reading</a>";
|
||||
@ -120,7 +136,7 @@ while ( my $url = <DATA>) {
|
||||
} # while DATA
|
||||
|
||||
#close out the list URL html
|
||||
$listHTML .= "</div></ul>\n";
|
||||
$listHTML .= "</ul></div>\n";
|
||||
|
||||
###################################
|
||||
# Make an RSS Feed!
|
||||
@ -151,7 +167,7 @@ foreach my $name (reverse sort keys %list) {
|
||||
link => $list{$name}->{'link'},
|
||||
description => $list{$name}->{'description'},
|
||||
pubDate => $list{$name}->{'pubDate'},
|
||||
author => $list{$name}->{'dc'}{'creator'},
|
||||
author => $list{$name}->{'itemAuthor'},
|
||||
source => $list{$name}->{'feedName'},
|
||||
sourceUrl => $list{$name}->{'feedURL'},
|
||||
); # $rss->channel
|
||||
@ -204,10 +220,9 @@ my $html = <<"HTML_END";
|
||||
body{
|
||||
margin:40px auto;
|
||||
max-width:650px;
|
||||
line-height:1.6;
|
||||
font-size:18px;
|
||||
font-family: Baskerville, TimesNewRoman, Times New Roman, Times, Georgia, serif;
|
||||
padding:0 10px
|
||||
font: 18px/1.6 Baskerville, TimesNewRoman, Times New Roman, Times, Georgia, serif;
|
||||
padding:0 10px:
|
||||
word-break: break-word;
|
||||
}
|
||||
h1, h2, h3 {font-weight: 200;}
|
||||
hr{width:50%;}
|
||||
@ -238,7 +253,7 @@ my $html = <<"HTML_END";
|
||||
|
||||
<h1>$title</h1>
|
||||
<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>
|
||||
|
||||
</header>
|
||||
@ -304,12 +319,13 @@ close(FH);
|
||||
###################################
|
||||
|
||||
sub formatDate {
|
||||
# takes a date, and converts it to a formatted string
|
||||
my $testDate = $_[0];
|
||||
$testDate =~ s/((\+|\-)(\d\d\d\d))//;
|
||||
# Convert to a TIME object
|
||||
my $t = Time::Piece->strptime($testDate);
|
||||
return($t->strftime('%a, %d %b %Y %H:%M:%S'));
|
||||
}
|
||||
} # sub formatDate
|
||||
|
||||
# FIN
|
||||
|
||||
@ -325,10 +341,10 @@ https://kelliowen.com/feed/
|
||||
https://mercedesmyardley.com/feed/
|
||||
https://mehitobel.com/feed/
|
||||
http://antoncancre.blogspot.com/feeds/posts/default?alt=rss
|
||||
https://marysangi.wordpress.com/feed/
|
||||
https://www.toddkeisling.com/news?format=rss
|
||||
https://www.jfgonzalez.org/news?format=rss
|
||||
https://www.briankeene.com/news?format=rss
|
||||
https://ghoulish.rip/feed/
|
||||
https://www.cemeterydance.com/extras/feed/
|
||||
https://www.gwendolynkiste.com/Blog/feed/
|
||||
https://katherinesilvaauthor.substack.com/feed
|
||||
@ -338,3 +354,14 @@ http://jacobhaddon.com/feed/
|
||||
http://apokrupha.com/feed/
|
||||
https://ellendatlow.com/feed/
|
||||
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/
|
||||
http://liviallewellyn.com/feed/
|
Loading…
x
Reference in New Issue
Block a user