Debian Codegraph @

ebay/lib/WWW/Search/Ebay/Category.pm

raw
1
2 =head1 NAME
3
4 WWW::Search::Ebay::Category - backend for returning entire categories on www.ebay.com
5
6 =head1 SYNOPSIS
7
8 use WWW::Search;
9 my $oSearch = new WWW::Search('Ebay::Category');
10 # Category 1381 is Disney Modern Premiums:
11 $oSearch->native_query(1381);
12 while (my $oResult = $oSearch->next_result())
13 { print $oResult->url, "\n"; }
14
15 =head1 DESCRIPTION
16
17 This class is a Ebay specialization of L<WWW::Search>.
18 It handles making and interpreting Ebay searches
19 F<http://www.ebay.com>.
20
21 This class exports no public interface; all interaction should
22 be done through L<WWW::Search> objects.
23
24 =head1 NOTES
25
26 Returns the "first" 200 *auction* items in the given category.
27 I'm not sure what exactly "first" means in this case; YMMV.
28
29 It is up to you to determine the number of the category you want.
30
31 See the NOTES section of L<WWW::Search::Ebay> for a description of the results.
32
33 =head1 METHODS
34
35 =cut
36
37 #####################################################################
38
39 package WWW::Search::Ebay::Category;
40
41 use strict;
42 use warnings;
43
44 use Carp;
45 use Date::Manip;
46 use base 'WWW::Search::Ebay';
47
48 our
49 $VERSION = 2.611;
50
51 our $MAINTAINER = 'Martin Thurn <[email protected]>';
52
53 use constant DEBUG_FUNC => 0;
54
55 sub _native_setup_search
56 {
57 my ($self, $native_query, $rhOptsArg) = @_;
58 $rhOptsArg ||= {};
59 unless (ref($rhOptsArg) eq 'HASH')
60 {
61 carp " --- second argument to _native_setup_search should be hashref, not arrayref";
62 return undef;
63 } # unless
64 $self->{_options} = {
65 _ipg => 200,
66 _sacat => $native_query,
67 };
68 return $self->SUPER::_native_setup_search($native_query, $rhOptsArg);
69 } # _native_setup_search
70
71
72 sub _get_result_count_elements
73 {
74 my $self = shift;
75 my $tree = shift;
76 my @ao;
77 push @ao, $tree->look_down(
78 _tag => 'h2',
79 class => 'srp-controls__count-heading',
80 );
81 return @ao;
82 }
83
84 sub _get_itemtitle_tds
85 {
86 my $self = shift;
87 my $tree = shift;
88 printf STDERR (" TTT this is Category::_get_itemtitle_tds") if (1 < $self->{_debug});
89 my @ao;
90 push @ao, $tree->look_down(_tag => 'div',
91 class => 's-item__image-section',
92 );
93 printf STDERR (" DDD found %d itemtitle tags", scalar(@ao)) if (1 < $self->{_debug});
94 return @ao;
95 } # _get_itemtitle_tds
96
97 sub _preprocess_results_page_OFF
98 {
99 my $self = shift;
100 my $sPage = shift;
101 # For debugging:
102 print STDERR $sPage;
103 exit 88;
104 } # preprocess_results_page
105
106 sub _columns_use_SUPER
107 {
108 my $self = shift;
109 # This is for basic USA eBay:
110 return qw( paypal bids price shipping enddate );
111 } # _columns
112
113
114 1;
115
116 =head1 SEE ALSO
117
118 To make new back-ends, see L<WWW::Search>.
119
120 =head1 CAVEATS
121
122 =head1 BUGS
123
124 Please tell the author if you find any!
125
126 =head1 AUTHOR
127
128 Maintained by Martin Thurn, C<[email protected]>, L<http://www.sandcrawler.com/SWB/cpan-modules.html>.
129
130 =head1 LEGALESE
131
132 Copyright (C) 1998-2009 Martin 'Kingpin' Thurn
133
134 THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
135 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
136 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
137
138 =cut
139
140 __END__