line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# $Id: ES.pm,v 2.104 2013-03-03 15:03:57 Martin Exp $ |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
WWW::Search::Ebay::ES - backend for searching auctions at eBay Spain |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use WWW::Search; |
11
|
|
|
|
|
|
|
my $oSearch = new WWW::Search('Ebay::ES'); |
12
|
|
|
|
|
|
|
my $sQuery = WWW::Search::escape_query("Yakface"); |
13
|
|
|
|
|
|
|
$oSearch->native_query($sQuery); |
14
|
|
|
|
|
|
|
while (my $oResult = $oSearch->next_result()) |
15
|
|
|
|
|
|
|
{ print $oResult->url, "\n"; } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Acts just like WWW::Search::Ebay. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 AUTHOR |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Martin 'Kingpin' Thurn, C, L. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package WWW::Search::Ebay::ES; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
373031
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
30
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
10
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
91
|
|
33
|
1
|
|
|
1
|
|
8
|
use base 'WWW::Search::Ebay'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
367
|
|
34
|
|
|
|
|
|
|
our |
35
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 2.104 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _native_setup_search |
38
|
|
|
|
|
|
|
{ |
39
|
2
|
|
|
2
|
|
5391838
|
my ($self, $native_query, $rhOptsArg) = @_; |
40
|
2
|
|
|
|
|
8
|
$self->{search_host} = 'http://www.ebay.es'; |
41
|
2
|
|
|
|
|
20
|
return $self->SUPER::_native_setup_search($native_query, $rhOptsArg); |
42
|
|
|
|
|
|
|
} # _native_setup_search |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# This is what we look_down for to find the HTML element that contains |
45
|
|
|
|
|
|
|
# the result count: |
46
|
|
|
|
|
|
|
sub _result_count_element_specs_USE_DEFAULT |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
return ( |
49
|
0
|
|
|
0
|
|
0
|
'_tag' => 'div', |
50
|
|
|
|
|
|
|
class => 'count' |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} # _result_count_element_specs |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _result_count_pattern |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
|
0
|
return qr'(?:encontrados?\s+)?(\d+)\s+(art(í|Ã)culo|resultado|anuncio)s?'; |
58
|
|
|
|
|
|
|
} # _result_count_pattern |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _next_text |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
# The text of the "Next" button, localized: |
64
|
0
|
|
|
0
|
|
0
|
return 'Siguiente'; |
65
|
|
|
|
|
|
|
} # _next_text |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _currency_pattern |
68
|
|
|
|
|
|
|
{ |
69
|
1
|
|
|
1
|
|
3266371
|
my $self = shift; |
70
|
|
|
|
|
|
|
# A pattern to match all possible currencies found in eBay listings |
71
|
|
|
|
|
|
|
# (if one character looks weird, it's really a British Pound symbol |
72
|
|
|
|
|
|
|
# but Emacs shows it wrong): |
73
|
1
|
|
|
|
|
14
|
my $W = $self->whitespace_pattern; |
74
|
1
|
|
|
|
|
54
|
return qr{[\d.,]+$W+EUR}; # } } # Emacs indentation bugfix |
75
|
|
|
|
|
|
|
} # _currency_pattern |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _preprocess_results_page_OFF |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
0
|
|
|
my $self = shift; |
80
|
0
|
|
|
|
|
|
my $sPage = shift; |
81
|
|
|
|
|
|
|
# print STDERR Dumper($self->{response}); |
82
|
|
|
|
|
|
|
# For debugging: |
83
|
0
|
|
|
|
|
|
print STDERR $sPage; |
84
|
0
|
|
|
|
|
|
exit 88; |
85
|
|
|
|
|
|
|
} # _preprocess_results_page |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _columns |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
|
|
my $self = shift; |
90
|
|
|
|
|
|
|
# This is for ES: |
91
|
0
|
|
|
|
|
|
return qw( paypal bids price shipping enddate ); |
92
|
|
|
|
|
|
|
} # _columns |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _process_date_abbrevs |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
|
|
my $self = shift; |
97
|
0
|
|
|
|
|
|
my $s = shift; |
98
|
0
|
|
|
|
|
|
$s =~ s!Tiempo\s+restante:!!gi; |
99
|
|
|
|
|
|
|
# Convert Spanish abbreviations for units of time to something |
100
|
|
|
|
|
|
|
# Date::Manip can parse (namely, English words): |
101
|
0
|
|
|
|
|
|
$s =~ s!(\d)d!$1 days!; |
102
|
0
|
|
|
|
|
|
$s =~ s!(\d)h!$1 hours!; |
103
|
0
|
|
|
|
|
|
$s =~ s!(\d)m!$1 minutes!; |
104
|
0
|
|
|
|
|
|
return $s; |
105
|
|
|
|
|
|
|
} # _process_date_abbrevs |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |