WWW::Search::Easynews - class for searching for files at Easynews
use WWW::Search; my $search = new WWW::Search("Easynews");
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
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.
user($uname)
pass($password)
See the WWW::Search manpage for more detailed information about these and other inherited functions.
new($backend)
my $search = new WWW::Search('Easynews');
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.
See the WWW::SearchResult manpage for more information about these and other inherited functions.
title()
description()
url()
urls()
.
urls()
size()
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()
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.
The second argument to native_query()
is a hash of options.
This hash can contain the following keys:
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
is set to 1
, the hits are returned in reverse order. Default is 0
100
Nothing.
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
Trond Michelsen <trondmm-perl@crusaders.no>