#! /usr/bin/perl -w
BEGIN {
unshift(@INC, "/home/suburban/public_html/yubaba");
# Add the directory where this file is to the beginning of @INC
}
use strict;
use CGI qw(:standard);
use RSS2html;
use NoFace; #old script to scrape weather.com. broken.
#yubaba.pl is the RSS feed script it should be run by a cron job every half-hour or so.
#sussman may 03
#****************************************************************
# REMEMBER TO REMOVE SLASHDOT FROM rssList.txt BEFORE TESTING! *
#****************************************************************
#MAIN
my $rss_feeds = "/home/suburban/public_html/yubaba/rssList.txt"; #List of RSS uris, one per line
my $non_rss = "/home/suburban/public_html/yubaba/nonRss.txt";
my $parser = new rss2html;
my $grab = new NoFace;
my $display = new CGI;
#my %syndicate = $grab -> get_facts ($non_rss);
#wtr_high, wtr_low, wtr_cloud_condition, wtr_tomorrow_temp, wtr_tomorrow_cloud
#print $display->header;
#print start_html(-title=>'suburbanangst.com: news',
# -head=>Link({-rel=>"stylesheet",
# -href=>"http://suburbanangst.com/style.css"})
# );
print start_html(-title=>'suburbanangst.com: news',
-head=>
Link(
{
-rel=>"stylesheet",
-href=>"http://suburbanangst.com/style.css"
}
),
-script=>
{
type=>"text/javascript",
code=>'setTimeout("window.location.reload(true)", 900*1000); // refresh time in ms'
}
);
print <<HTML;
<table width="100%">
<tr>
<td style="text-align: center;"><a href="bookmarks.html">Bookmarks</a> ||
<a href="http://onemorebug.com">OneMoreBug.com</a> ||
<a href="http://tommyz.net">TommyZ.net</a> ||
<a href="http://OneMoreBug.com/">Web Design Seminar</a> || <a href="/PL/">Perl Scripts</a>
</td>
</tr>
<tr>
<td style="text-align: center;"><a href="help/">Resources</a> ||
<a href="game/">GURPS Teleria</a>
</td>
</tr>
<tr>
<td style="text-align: center;">
<h3>Welcome to Suburban Angst!</h3>
</td>
</tr>
HTML
print "<tr><td style="text-align: center;">";
print "</td></tr><tr><td style="text-align: center;"><a href="http://www.srh.noaa.gov/data/forecasts/NYZ072.php?warncounty=NYC061&city=New+York">Weather</a> || <a href="http://nyt.com">New York Times</a> || <a href="http://google.com">Google</a> || <a href="http://h2odev.law.harvard.edu/ezuckerman/">Google Map</a>";
print "<p></p><!-- <p style="text-align: center;">Last updated ";
print scalar localtime();
print " PST<p/> gotta fix this! -->";
#THE KKK TOOK MY WEATHER CHANNEL AWAY
#print "<p>$syndicate{'wtr_cloud_condition'}, <b>$syndicate{'wtr_high'}</b>, High/Low: <b>$syndicate{'wtr_low'}.</b> Precip: <b>$syndicate{'wtr_precip'}.</b> <i>Tomorrow:</i> $syndicate{'wtr_tomorrow_cloud'}, $syndicate{'wtr_tomorrow_temp'}, precip: $syndicate{'wtr_tomorrow_precip'}.</p>";
print "<a href="http://dailyrotten.com">Daily Rotten</a> || <a href="http://consumptionjunction.com/content/browse.asp?type=8">Consumption Junction Daily</a> || <a href="http://freshnews.org">FreshNews</a></p>";
print "</td></tr></table>
";
print <<HTML;
<table cellspacing="10" width="60%%" align="center">
HTML
render($rss_feeds);
print <<HTML;
</table>
HTML
print $display->end_html;
#****************************************************************
# SUBROUTINES *
#****************************************************************
sub render {
$ARGV[0] = shift; #argument is my RSS feeds
my $counter = 0; #counts the number of boxes
my $other_counter = 0; #counts the number of boxes in a column
my $number_of_entries = 0; #must be an even number. half the entries go in one column, half in the other. overflow entries span the whole screen.
#****************
#Assumes we are reading a file with one URL on each line
#****************
while (<>) {
chomp(my $url = $_);
if ($url ne "") {
if ($counter == 0) { print "<tr><!--1a-->";
}
if ($other_counter == 0) {
print '<td class="blogborder"><!--2a-->';
}
$parser -> rss_get ($url);
if ($other_counter >= ($number_of_entries / 2) -1) {
print "<!--2b--></td>";
$other_counter = 0;
}
else {
++$other_counter;
}
if ($counter >= ($number_of_entries) -1 ) {
print "</tr><!--1b-->";
$counter = 0;
}
else {
++$counter;
}
}
}
}
Aggregate RSS feeds
Category: Uncategorized |
Tags: 2003, aggregator, atom, community, homepage, html, http, publish, rss, suburbanangstcom, web, xml
Leave a Reply
You must be logged in to post a comment.