NAME

WWW::Google::News - Access to Google's News Service (Not Usenet)

SYNOPSIS

use WWW:Google::News qw(get_news);
my $results = get_news();

my $results = get_news_for_topic('impending asteriod impact');

DESCRIPTION

This module provides a couple of methods to scrape results from Google News, returning a data structure similar to the following (which happens to be suitable to feeding into XML::RSS).

{
  'Top Stories' =>
            [
             {
               'url' => 'http://www.washingtonpost.com/wp-dyn/articles/A9707-2002Nov19.html',
               'headline' => 'Amendment to Homeland Security Bill Defeated'
             },
             {
               'url' => 'http://www.ananova.com/news/story/sm_712444.html',
               'headline' => 'US and UN at odds as Iraq promises to meet deadline'
             }
            ],
  'Entertainment' =>
           [
            {
              'url' => 'http://abcnews.go.com/sections/entertainment/DailyNews/Coburn021119.html',
              'headline' => 'James Coburn Dies'
            },
            {
              'url' => 'http://www.cbsnews.com/stories/2002/11/15/entertainment/main529532.shtml',
              'headline' => '007s On Parade At \'Die\' Premiere'
            }
           ]
 }

METHODS

get_news()

Scrapes http://news.google.com/news/gnmainlite.html and returns a reference to a hash keyed on News Section, which points to an array of hashes keyed on URL and Headline.

get_news_for_topic( $topic )

Queries http://news.google.com/news for results on a particular topic, and returns a pointer to an array of hashes containing result data.

An RSS feed can be constructed from this very easily:

	use WWW::Google::News;
	use XML::RSS;

	$results = get_news_for_topic( $topic )
	my $rss = XML::RSS->new;
	$rss->channel(title => "Google News -- $topic");
	for (@{$news}) {
                $rss->add_item(
                        title => $_->{headline},
                        link  => $_->{url},
                        description  => $_->{description},
                );
        }
        print $rss->as_string;
get_news_greg_style()

It also provides a method called get_news_greg_style() which returns the same data, only using a hash keyed on story number instead of the array described in the above.

TODO

* Implement an example RSS feed. -- Done, see above

* Seek out a good psychologist so we can work through Greg's obsession with hashes.

AUTHORS

Greg McCarroll <greg@mccarroll.demon.co.uk>, Bowen Dwelle <bowen@dwelle.org>

KUDOS

Darren Chamberlain for rss_alternate.pl

Leon Brocard for pulling me up on my obsessive compulsion to use hashes.

SEE ALSO

http://news.google.com/ http://news.google.com/news/gnmainlite.html

1 POD Error

The following errors were encountered while parsing the POD:

Around line 198:

You forgot a '=back' before '=head1'