Merge branch 'smhn'
This commit is contained in:
commit
1cb4d8d03d
25
smhnRSS.pl
25
smhnRSS.pl
@ -28,10 +28,12 @@ use HTML::Entities; # https://metacpan.org/pod/HTML::Entities
|
|||||||
# server file folders
|
# server file folders
|
||||||
# my $rssFilePath = "/home/USER_FOLDER/public_html/feed.xml";
|
# my $rssFilePath = "/home/USER_FOLDER/public_html/feed.xml";
|
||||||
# my $htmlFilePath = "/home/USER_FOLDER/public_html/index.html";
|
# my $htmlFilePath = "/home/USER_FOLDER/public_html/index.html";
|
||||||
|
# my $errorFilePath = "/home/USER_FOLDER/public_html/feed.log";
|
||||||
|
|
||||||
# local file folders
|
# local file folders
|
||||||
my $rssFilePath = "feed.xml";
|
my $rssFilePath = "feed.xml";
|
||||||
my $htmlFilePath = "index.html";
|
my $htmlFilePath = "index.html";
|
||||||
|
my $errorFilePath = "feed.log";
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# RSS Configurations
|
# RSS Configurations
|
||||||
@ -63,6 +65,9 @@ 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";
|
||||||
|
|
||||||
|
# Make a list of URLs that have an error
|
||||||
|
my $listURLError = "The following feeds had issues this time:\n\n" . $now->strftime('%a, %d %b %Y %H:%M:%S %z'). "\n\n";
|
||||||
|
|
||||||
# Go through each URL in the DATA section and make the new list
|
# 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;
|
||||||
@ -76,7 +81,12 @@ while ( my $url = <DATA>) {
|
|||||||
# parse the XML
|
# parse the XML
|
||||||
my $rss1 = XML::RSS->new;
|
my $rss1 = XML::RSS->new;
|
||||||
eval { $rss1->parse( $xml ) };
|
eval { $rss1->parse( $xml ) };
|
||||||
next if $@;
|
|
||||||
|
# if empty, add URL to log file variable
|
||||||
|
if ($@) {
|
||||||
|
$listURLError .= "* " . $url . "\n";
|
||||||
|
next;
|
||||||
|
}; # if $@
|
||||||
|
|
||||||
# go through the items from the XML
|
# go through the items from the XML
|
||||||
for (my $j = 0; $j <= $number_of_items; $j++){
|
for (my $j = 0; $j <= $number_of_items; $j++){
|
||||||
@ -138,6 +148,14 @@ while ( my $url = <DATA>) {
|
|||||||
#close out the list URL html
|
#close out the list URL html
|
||||||
$listHTML .= "</ul></div>\n";
|
$listHTML .= "</ul></div>\n";
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Write the error file
|
||||||
|
###################################
|
||||||
|
|
||||||
|
open(FH, '>', $errorFilePath) or die $!;
|
||||||
|
print FH $listURLError;
|
||||||
|
close(FH);
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# Make an RSS Feed!
|
# Make an RSS Feed!
|
||||||
###################################
|
###################################
|
||||||
@ -204,6 +222,9 @@ my $printDate = formatDate($rss2->{'channel'}{'pubDate'});
|
|||||||
# header for a direct HTML post
|
# header for a direct HTML post
|
||||||
my $html_header = "Status: 200\nContent-type: text/html\n\n";
|
my $html_header = "Status: 200\nContent-type: text/html\n\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# Make the HTML Page
|
# Make the HTML Page
|
||||||
###################################
|
###################################
|
||||||
@ -335,6 +356,7 @@ sub formatDate {
|
|||||||
|
|
||||||
__DATA__
|
__DATA__
|
||||||
https://ecatherine.com/feed/
|
https://ecatherine.com/feed/
|
||||||
|
https://lynnehansen.zenfolio.com/blog.rss
|
||||||
https://redlagoe.com/feed/
|
https://redlagoe.com/feed/
|
||||||
https://diebooth.wordpress.com/feed/
|
https://diebooth.wordpress.com/feed/
|
||||||
https://kelliowen.com/feed/
|
https://kelliowen.com/feed/
|
||||||
@ -362,6 +384,5 @@ http://robertfordauthor.com/feed/
|
|||||||
https://tinyfrights.com/feed/
|
https://tinyfrights.com/feed/
|
||||||
https://weightlessbooks.com/feed/
|
https://weightlessbooks.com/feed/
|
||||||
https://www.crystallakepub.com/feed/
|
https://www.crystallakepub.com/feed/
|
||||||
https://lynnehansen.zenfolio.com/blog.rss
|
|
||||||
https://www.bevvincent.com/feed/
|
https://www.bevvincent.com/feed/
|
||||||
http://liviallewellyn.com/feed/
|
http://liviallewellyn.com/feed/
|
Loading…
x
Reference in New Issue
Block a user