| 1 | |||
| 2 | # $Id: BuyItNow.pm,v 1.16 2013-06-23 18:31:15 martin Exp $ | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | WWW::Search::Ebay::BuyItNow - backend for searching eBay Buy-It-Now items | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | use WWW::Search; | ||
| 11 | my $oSearch = new WWW::Search('Ebay::BuyItNow'); | ||
| 12 | my $sQuery = WWW::Search::escape_query("jawa"); | ||
| 13 | $oSearch->native_query($sQuery); | ||
| 14 | while (my $oResult = $oSearch->next_result()) | ||
| 15 | { print $oResult->url, "\n"; } | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This class is a Ebay specialization of WWW::Search. | ||
| 20 | It handles making and interpreting Ebay searches | ||
| 21 | F<http://www.ebay.com>. | ||
| 22 | |||
| 23 | This class exports no public interface; all interaction should | ||
| 24 | be done through L<WWW::Search> objects. | ||
| 25 | |||
| 26 | =head1 NOTES | ||
| 27 | |||
| 28 | The search is done against eBay Buy-It-Now items only. | ||
| 29 | |||
| 30 | The query is applied to TITLES only. | ||
| 31 | |||
| 32 | In the resulting WWW::Search::Result objects, the description field | ||
| 33 | consists of a human-readable combination (joined with semicolon-space) | ||
| 34 | of the Item Number; number of bids; and high bid amount (or starting | ||
| 35 | bid amount). | ||
| 36 | |||
| 37 | =head1 SEE ALSO | ||
| 38 | |||
| 39 | To make new back-ends, see L<WWW::Search>. | ||
| 40 | |||
| 41 | =head1 BUGS | ||
| 42 | |||
| 43 | Please tell the author if you find any! | ||
| 44 | |||
| 45 | =head1 AUTHOR | ||
| 46 | |||
| 47 | Martin 'Kingpin' Thurn, C<mthurn at cpan.org>, L<http://tinyurl.com/nn67z>. | ||
| 48 | |||
| 49 | =head1 LICENSE | ||
| 50 | |||
| 51 | Copyright (C) 1998-2009 Martin 'Kingpin' Thurn | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | package WWW::Search::Ebay::BuyItNow; | ||
| 56 | |||
| 57 | use strict; | ||
| 58 | use warnings; | ||
| 59 | |||
| 60 | use WWW::Search::Ebay; | ||
| 61 | use base 'WWW::Search::Ebay'; | ||
| 62 | our | ||
| 63 | $VERSION = do { my @r = (q$Revision: 1.16 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; | ||
| 64 | |||
| 65 | sub _native_setup_search | ||
| 66 | { | ||
| 67 | my ($self, $sQuery, $rh) = @_; | ||
| 68 | # http://shop.ebay.com/items/_W0QQLHQ5fBINZ1QQLHQ5fIncludeSIFZ1?_nkw=Burkina+Faso+flag&_sacat=0&_fromfsb=&_trksid=m270.l1313&_odkw=Burkina+Faso&_osacat=0 | ||
| 69 | # http://shop.ebay.com/items/_W0QQLHQ5fBINZ1QQLHQ5fIncludeSIFZ1?_nkw=Burkina+Faso+flag | ||
| 70 | $self->{search_host} = q{http://shop.ebay.com}; | ||
| 71 | $self->{search_path} = q{/items/_W0QQLHQ5fBINZ1}; | ||
| 72 | $self->{'_options'} = { | ||
| 73 | '_nkw' => $sQuery, | ||
| 74 | }; | ||
| 75 | return $self->SUPER::_native_setup_search($sQuery, $rh); | ||
| 76 | } # _native_setup_search | ||
| 77 | |||
| 78 | sub _columns | ||
| 79 | { | ||
| 80 | my $self = shift; | ||
| 81 | return qw( price ); | ||
| 82 | } # _columns | ||
| 83 | |||
| 84 | 1; | ||
| 85 | |||
| 86 | __END__ |