#!/usr/bin/perl my($contentblock) = 0; my($what) = 0; my(@news); my %urls_heads = (); my @lines = <>; # get last article number my $lastnr = `cat ~/.liferea/.heise3rss-last-nr 2>/dev/null`; if ($lastnr =~ /^(\d+)$/) { $lastnr = $1; } else { $lastnr = 0; } # gather links to article full texts foreach (@lines) { chomp; if ($_ eq "") { $contentblock = 1; next; } if ($_ eq "") { last; } if ($contentblock == 1) { if(/^(.*)<\/a>/) { $urls_heads{$1} = $2 } } } # test for curl `curl --help`; if($? == 512) { # process collected links and get article texts foreach my $url (sort keys %urls_heads) { $url =~ /meldung\/(\d+)$/; if($lastnr < $1) { $lastnr = $1; @lines = `curl -s http://www.heise.de$url`; $contentblock = 0; $content = ""; foreach(@lines) { s###i; s#Anzeige
##i; if($_ =~ /<\!-- Meldung -->/) { $contentblock = 1; next; } last if($_ =~ /<\!-- untere News-Navigation -->/); if($contentblock == 1) { $content .= $_; } } push(@news, $urls_heads{$url}); push(@news, $url); push(@news, ""); } } } else { push(@news, "Filter script failed! curl not found!"); push(@news, " "); push(@news, "This filter script uses curl to download websites. And it seems like curl is not installed!\n"); } print "\n". "\n". "\n". " heise online news\n". " http://www.heise.de/newsticker/\n". " Nachrichten aus der Welt des Computers\n". "\n"; $what = 0; foreach (@news) { if ($_ eq "") { next; } if ($what == 0) { print "\n$_\n"; $what = 1; next; } elsif ($what == 1) { print "http://www.heise.de$_\n"; $what = 2; next; } else { print "Sorry but your reader must support the content namespace!\n"; print "$_\n\n"; $what = 0; } } print "\n"; `test -d ~/.liferea || mkdir ~/.liferea`; `echo $lastnr > ~/.liferea/.heise3rss-last-nr 2>/dev/null`;