Compare commits
2 Commits
e8b01b292c
...
main
Author | SHA1 | Date | |
---|---|---|---|
edc7bcae6a | |||
5e393fd674 |
@ -38,7 +38,13 @@ Example paths are given for CPanel type servers:
|
|||||||
|
|
||||||
* Feed - /home/USER_NAME/public_html/feed.xml
|
* Feed - /home/USER_NAME/public_html/feed.xml
|
||||||
* HTML - /home/USER_NAME/public_html/index.html
|
* HTML - /home/USER_NAME/public_html/index.html
|
||||||
* Error Log - /home/USER_FOLDER/public_html/feed.log
|
* Error Log - /home/USER_NAME/public_html/feed.log
|
||||||
|
|
||||||
|
You can change the length of time the feed retains by altering this variable to the time you’d like in weeks:
|
||||||
|
|
||||||
|
```
|
||||||
|
my $num_weeks = 2;
|
||||||
|
```
|
||||||
|
|
||||||
## The Site
|
## The Site
|
||||||
|
|
||||||
|
10
blankRSS.pl
10
blankRSS.pl
@ -21,6 +21,7 @@ use warnings;
|
|||||||
# Packages
|
# Packages
|
||||||
|
|
||||||
use Time::Piece; # https://perldoc.perl.org/Time::Piece
|
use Time::Piece; # https://perldoc.perl.org/Time::Piece
|
||||||
|
use Time::Seconds; # https://perldoc.perl.org/Time::Seconds
|
||||||
use LWP::Simple; # https://metacpan.org/pod/LWP::Simple
|
use LWP::Simple; # https://metacpan.org/pod/LWP::Simple
|
||||||
use XML::RSS; # https://metacpan.org/pod/XML::RSS
|
use XML::RSS; # https://metacpan.org/pod/XML::RSS
|
||||||
use HTML::Entities; # https://metacpan.org/pod/HTML::Entities
|
use HTML::Entities; # https://metacpan.org/pod/HTML::Entities
|
||||||
@ -52,9 +53,12 @@ my $copyright = 'Copyright respective writers';
|
|||||||
# add to new RSS feed object
|
# add to new RSS feed object
|
||||||
###################################
|
###################################
|
||||||
|
|
||||||
|
# number of weeks in the past to hold RSS feed
|
||||||
|
my $num_weeks = 2;
|
||||||
|
|
||||||
# get today, subtact time to make cut off
|
# get today, subtact time to make cut off
|
||||||
my $now = localtime;
|
my $now = localtime;
|
||||||
my $then = $now->add_months(-2);
|
my $then = $now - (ONE_WEEK * $num_weeks);
|
||||||
|
|
||||||
#number of items to keep from each feed
|
#number of items to keep from each feed
|
||||||
my $number_of_items = 2; # +1 since everything starts at 0
|
my $number_of_items = 2; # +1 since everything starts at 0
|
||||||
@ -146,7 +150,7 @@ while ( my $url = <DATA>) {
|
|||||||
} # while DATA
|
} # while DATA
|
||||||
|
|
||||||
#close out the list URL html
|
#close out the list URL html
|
||||||
$listHTML .= "</div></ul>\n";
|
$listHTML .= "</ul></div>\n";
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# Write the error file
|
# Write the error file
|
||||||
@ -185,7 +189,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
|
||||||
|
Reference in New Issue
Block a user