NAME

WWW::Search::Easynews - class for searching for files at Easynews


SYNOPSIS

  use WWW::Search;
  my $search = new WWW::Search("Easynews");


DESCRIPTION

Easynews.com is a subscription usenet-service. They have a website with archives of the last few days of binary-posts from many groups. This module is useless unless you have an account at Easynews.com.

This class is an Easynews specialization of WWW::Search. It handles making and interpreting Easynews searches


IMPORTANT

It is a violation of the Easynews TOS to share one account between several people. So it is important that you make sure that every user of the scripts that use these modules log in with their own account. Look in the examples/ directory for examples of scripts that does this.

It is also important to remember that you are only allowed to log in to easynews.com from two different domains. If you already log in from two domains, and use these modules from a third domain, your account will be temporarily closed.


METHODS

user($uname)
Sets the username.

pass($password)
Sets the password.

Inherited from WWW::Search

See the WWW::Search manpage for more detailed information about these and other inherited functions.

new($backend)
To create a new WWW::Search::Easynews object, call
  my $search = new WWW::Search('Easynews');
native_query($search_string, \%hash_of_options)
This function sets up a query.

The first argument is a uri-escaped search-string. You can use the function WWW::Search::escape_query() for the uri-escaping.

The second is a reference to a hash of options for the search. The hash of options is optional in WWW::Search, but to search Easynews, you must enter the name of at least one newsgroup to search, so in this case, the options-hash is required.

See OPTIONS for more info about each option.

Inherited from WWW::SearchResult

See the WWW::SearchResult manpage for more information about these and other inherited functions.

title()
Easynews substitutes all non-word-characters to _ in filenames. This module looks for the original filename in the description of the search-results. This function returns the original filename if it is found, otherwise it returns the underscore-converted name.

description()
Returns the subject used when the file was posted to usenet.

url()
Returns the full url to the file. This url includes the underscore-converted filename. To get the url with the original filename, see urls().

urls()
Returns a reference to an array of urls. The array contains two urls for every file. The first has the underscore-convereted filename (as returned by url()). The second has the original filename.

size()
Returns the approximate size in bytes of the file.

Easynews displayes a short, rounded number for the filesize (like ``14.6 Megs''). This function calculates the size in bytes before it returns it. Several commonly used filesizes used in multipart-postings has been hardcoded into the module so that atleast _some_ files show the exact size :)

change_date()
Returns an approximation of the date/time when the file was posted.

Easynews reports the age of the file as a rounded number in minutes, hours or days (depending of how old it is) This function uses this value to determine the epoch-time of when the file was posted.

This is not very accurate, so this function will return different timestamps for the same file between two different searches.


OPTIONS

The second argument to native_query() is a hash of options. This hash can contain the following keys:

groups
The only required key.

Its value can be a string with the name of a single group to search, or a reference to an array of groups to search.

reverse
if reverse is set to 1, the hits are returned in reverse order. Default is 0

pageby
sets the number of hits you want Easynews to return for every page it loads. Default is 100


EXPORT

Nothing.


EXAMPLES

  use WWW::Search;
  my $search = new WWW::Search("Easynews");
  $search->user("username");
  $search->pass("password");
  my @groups = qw/alt.binaries.multimedia alt.binaries.movies/;
  $search->native_query($searchstring, { groups => \@groups });
  while (my $res = $search->next_result) {
    printf "%s\n  %s (%d bytes)\n  %s\n\n", 
        $res->description, $res->title, $res->size, $res->url;
  }

look in the examples/ directory for more examples


AUTHOR

Trond Michelsen <trondmm-perl@crusaders.no>


SEE ALSO

the WWW::Search manpage and the WWW::SearchResult manpage