Google News

Simply downloads and displays the headings of the current news topics (using wget).

Use ‘watch -n 960 ./news.pl’, to refresh news every 16 mins
(as google updates every 15mins, 16 to make sure it does actually change).

#!/usr/bin/perl
$_ = `wget --user-agent="mozilla/5.0" -q -O - 
 "http://news.google.co.uk/nwshp?hl=en&tab=wn&q=&output=rss" 2> /dev/null`;
@words =  /<title>(.*?)</title>/sig;
for($i=2;$i<=$#words;$i++){
 $_=@words[$i];
 s/(&|#\d+;)//g;
 print "$_\n";
}
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: