# perldoc > WWW::Search::Ebay

---
type: CommandReference
command: WWW::Search::Ebay
mode: perldoc
section: 
source: perldoc
---

## Quick Reference
- `my $search = WWW::Search->new('Ebay')` — create eBay search backend
- `$search->native_query($query)` — execute search with title query
- `while (my $result = $search->next_result()) { ... }` — iterate results
- `$search->native_query($query, { _mPrRngCbx => 1, _udlo => $min, _udhi => $max })` — search with price range
- `$search->{categories}` — reference to array of category hashes after search
- `$search->result_as_HTML($result)` — format result as HTML string

## Name
`WWW::Search::Ebay` — backend for searching eBay (current auctions only, titles only, max 200 results)

## Synopsis
perl
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";
}
## Options
- `_mPrRngCbx` — set to `1` to enable price range filtering
- `_udlo` — minimum price (e.g., `$minPrice`)
- `_udhi` — maximum price (e.g., `$maxPrice`)

## Methods
### Public Methods
- `user_agent_delay()` — introduce a delay to avoid overwhelming the server
- `need_to_delay()` — controls whether delay is applied
- `preprocess_results_page()` — captures eBay Official Time for accurate DTG parsing
- `result_as_HTML($result, $date_format)` — formats a `WWW::Search::Result` as HTML; optional `$date_format` string as per `Date::Manip::UnixDate` (default `'%Y-%m-%d %H:%M:%S'`)

### Subclassing Methods
- `_get_result_count_elements($tree)` — returns list of `HTML::Element` objects containing result count text
- `_get_itemtitle_tds($tree)` — returns list of `<TD>` elements with title links
- `_parse_category_list($tree)` — parses category list from left sidebar
- `_process_date_abbrevs($date_str)` — expands abbreviations for `Date::Manip`
- `_next_text()` — localized "Next" button text
- `whitespace_pattern()` — returns `qr//` pattern for whitespace in page language
- `_currency_pattern()` — returns `qr//` pattern matching monetary amounts
- `_title_pattern()` — returns `qr//` pattern to extract auction title, item number, end date (groups `$1`, `$2`, `$3`)
- `_result_count_pattern()` — returns `qr//` pattern to extract result count (`$1`)

## Result Object Fields
- `description()` — combined string: Item Number; bids; high bid/starting bid
- `end_date()` — auction end time in form "YYYY-MM-DD HH:MM TZ" (respects `TZ` environment variable, defaults to US/Pacific)
- `bid_count()` — integer number of bids
- `bid_amount()` — string like "$14.95" or "GBP 6.00"
- `sold()` — non-zero if item sold (only with `WWW::Search::Ebay::Completed`)

If the query is an eBay item number, the result will lack bid/price information.

## Examples
perl
# Basic search
use WWW::Search;
my $search = WWW::Search->new('Ebay');
$search->native_query(WWW::Search::escape_query("vintage toy"));
while (my $result = $search->next_result()) {
    print $result->url, ": ", $result->title, "\n";
}
perl
# Accessing categories after a search
$search->native_query("model train");
my $categories = $search->{categories};
foreach my $cat (@$categories) {
    print $cat->{Name}, " (", $cat->{Count}, " items)\n";
    foreach my $sub (@{$cat->{Subcategory}}) {
        print "  ", $sub->{Name}, " (", $sub->{Count}, ")\n";
    }
}
## See Also
- [WWW::Search](http://localhost/phpMan.php/perldoc/WWW%3A%3ASearch/markdown) — base class for search backends
- [WWW::Search::Ebay::Completed](http://localhost/phpMan.php/perldoc/WWW%3A%3ASearch%3A%3AEbay%3A%3ACompleted/markdown) — search completed auctions
- [WWW::Search::Ebay::Stores](http://localhost/phpMan.php/perldoc/WWW%3A%3ASearch%3A%3AEbay%3A%3AStores/markdown) — search eBay Stores
- [Date::Manip::UnixDate](http://localhost/phpMan.php/perldoc/Date%3A%3AManip%3A%3AUnixDate/markdown) — date formatting used by `result_as_HTML()`