NAME
WWW::Search::Ebay - backend for searching www.ebay.com
SYNOPSIS
use WWW::Search;
my $oSearch = new WWW::Search('Ebay');
my $sQuery = WWW::Search::escape_query("C-10 carded Yakface");
$oSearch->native_query($sQuery);
while (my $oResult = $oSearch->next_result())
{ print $oResult->url, "\n"; }
DESCRIPTION
This class is a Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches http://www.ebay.com.
This class exports no public interface; all interaction should be done through WWW::Search objects.
NOTES
The search is done against CURRENT running AUCTIONS only. (NOT completed auctions, NOT eBay Stores items, NOT Buy-It-Now only items.) (If you want to search completed auctions, use the WWW::Search::Ebay::Completed module.) (If you want to search eBay Stores, use the WWW::Search::Ebay::Stores module.)
The query is applied to TITLES only.
The results are ordered youngest auctions first (reverse order of auction listing date).
In the resulting WWW::Search::Result objects, the description() field consists of a human-readable combination (joined with semicolon-space) of the Item Number; number of bids; and high bid amount (or starting bid amount).
In the resulting WWW::Search::Result objects, the end_date() field contains a human-readable DTG of when the auction is scheduled to end (in the form "YYYY-MM-DD HH:MM TZ"). If environment variable TZ is set, the time will be converted to that timezone; otherwise the time will be left in ebay.com's default timezone (US/Pacific).
In the resulting WWW::Search::Result objects, the bid_count() field contains the number of bids as an integer.
In the resulting WWW::Search::Result objects, the bid_amount() field is a string containing the high bid or starting bid as a human-readable monetary value in seller-native units, e.g. "$14.95" or "GBP 6.00".
In the resulting WWW::Search::Result objects, the category() field contains the Ebay category number.
In the resulting WWW::Search::Result objects, the sold() field will be non-zero if the item has already sold. (Only if you're using WWW::Search::Ebay::Completed)
After a successful search, your search object will contain an element named 'categories' which will be a reference to an array of hashes containing names and IDs of categories and nested subcategories, and the count of items matching your query in each category and subcategory. (Special thanks to Nick Lokkju for this code!) For example:
$oSearch->{category} = [
{
'ID' => '1',
'Count' => 19,
'Name' => 'Collectibles',
'Subcategory' => [
{
'ID' => '13877',
'Count' => 11,
'Name' => 'Historical Memorabilia'
},
{
'ID' => '11450',
'Count' => 1,
'Name' => 'Clothing, Shoes & Accessories'
},
]
},
{
'ID' => '281',
'Count' => 1,
'Name' => 'Jewelry & Watches',
}
];
If your query string happens to be an eBay item number, (i.e. if ebay.com redirects the query to an auction page), you will get back one WWW::Search::Result without bid or price information.
OPTIONS
- Search descriptions
-
To search titles and descriptions, add 'srchdesc'=>'y' to the query options:
$oSearch->native_query($sQuery, { srchdesc => 'y' } );
- Search one category
-
To restrict your search to a particular eBay category, find out eBay's ID number for the category and add 'sacategory'=>123 to the query options:
$oSearch->native_query($sQuery, { sacategory => 48995 } );
If you send a single asterisk or a single space as the query string, the results will be ALL the auctions in that category.
PUBLIC METHODS OF NOTE
- native_setup_search
-
Part of the basic WWW::Search mantra. See WWW::Search for details.
- result_as_HTML
-
Given a WWW::SearchResult object representing an auction, formats it human-readably with HTML.
An optional second argument is the date format, a string as specified for Date::Manip::UnixDate. Default is '%Y-%m-%d %H:%M:%S'
my $sHTML = $oSearch->result_as_HTML($oSearchResult, '%H:%M %b %E');
METHODS TO BE OVERRIDDEN IN SUBCLASSING
- whitespace_pattern
-
Return a qr// pattern to match whitespace your webpage's language.
- currency_pattern
-
Return a qr// pattern to match mentions of money in your webpage's language. Include the digits in the pattern.
- title_pattern
-
Return a qr// pattern to match the webpage title in your webpage's language. Add grouping parenthesis so that $1 becomes the auction title, $2 becomes the eBay item number, and $3 becomes the end date.
- result_count_pattern
-
Return a qr// pattern to match the result count in your webpage's language. Include parentheses so that $1 becomes the number (with commas is OK).
SEE ALSO
To make new back-ends, see WWW::Search.
BUGS
Please tell the author if you find any!
AUTHOR
WWW::Search::Ebay
was written by and is maintained by Martin Thurn mthurn@cpan.org
, http://tinyurl.com/nn67z.
Some fixes along the way contributed by Troy Davis.
LEGALESE
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.