line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package WWW::Search::Ebay::DE; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
390511
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
49
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our |
8
|
|
|
|
|
|
|
$VERSION = 2.104; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
WWW::Search::Ebay::DE - backend for searching auctions at www.ebay.de |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use WWW::Search; |
17
|
|
|
|
|
|
|
my $oSearch = new WWW::Search('Ebay::DE'); |
18
|
|
|
|
|
|
|
my $sQuery = WWW::Search::escape_query("Yakface"); |
19
|
|
|
|
|
|
|
$oSearch->native_query($sQuery); |
20
|
|
|
|
|
|
|
while (my $oResult = $oSearch->next_result()) |
21
|
|
|
|
|
|
|
{ print $oResult->url, "\n"; } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Acts just like WWW::Search::Ebay. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 AUTHOR |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Martin 'Kingpin' Thurn, C, L. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
12
|
use Carp; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
86
|
|
34
|
1
|
|
|
1
|
|
13
|
use base 'WWW::Search::Ebay'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
479
|
|
35
|
|
|
|
|
|
|
# We need the version that allows shipping to be "unknown": |
36
|
1
|
|
|
1
|
|
20050
|
use WWW::Search::Ebay 2.273; |
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
535
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _native_setup_search |
39
|
|
|
|
|
|
|
{ |
40
|
2
|
|
|
2
|
|
5396758
|
my ($self, $native_query, $rhOptsArg) = @_; |
41
|
2
|
|
50
|
|
|
12
|
$rhOptsArg ||= {}; |
42
|
2
|
50
|
|
|
|
12
|
unless (ref($rhOptsArg) eq 'HASH') |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
|
|
0
|
carp " --- second argument to _native_setup_search should be hashref"; |
45
|
0
|
|
|
|
|
0
|
return undef; |
46
|
|
|
|
|
|
|
} # unless |
47
|
2
|
|
|
|
|
9
|
$self->{search_host} = 'http://www.ebay.de'; |
48
|
2
|
|
|
|
|
18
|
return $self->SUPER::_native_setup_search($native_query, $rhOptsArg); |
49
|
|
|
|
|
|
|
} # _native_setup_search |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# This is what we look_down for to find the HTML element that contains |
52
|
|
|
|
|
|
|
# the result count: |
53
|
|
|
|
|
|
|
sub _result_count_element_specs_NOT_NEEDED |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
return ( |
56
|
0
|
|
|
0
|
|
0
|
'_tag' => 'p', |
57
|
|
|
|
|
|
|
class => 'count' |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} # _result_count_element_specs |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _result_count_pattern |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
0
|
|
0
|
return qr'(\d+)\s+(Artikel|Ergebnisse|Angebote)'i; |
65
|
|
|
|
|
|
|
} # _result_count_pattern |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _next_text |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
# The text of the "Next" button, localized: |
70
|
0
|
|
|
0
|
|
0
|
return 'Weiter'; |
71
|
|
|
|
|
|
|
} # _next_text |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _currency_pattern |
74
|
|
|
|
|
|
|
{ |
75
|
|
|
|
|
|
|
# A pattern to match all possible currencies found in eBay listings |
76
|
|
|
|
|
|
|
# (if one character looks weird, it's really a British Pound symbol |
77
|
|
|
|
|
|
|
# but Emacs shows it wrong): |
78
|
1
|
|
|
1
|
|
4274350
|
return qr{(?:US\s?\$|£|EUR)}; # } } # Emacs indentation bugfix |
79
|
|
|
|
|
|
|
} # _currency_pattern |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 preprocess_results_page |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Tweak the HTML to make it easy to parse |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub preprocess_results_page |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
my $sPage = shift; |
91
|
|
|
|
|
|
|
# Make it easy to parse the shipping portion of the list: |
92
|
0
|
|
|
|
|
|
$sPage =~ s!()! | $1!g; |
93
|
|
|
|
|
|
|
# Clean up "no shipping info": |
94
|
0
|
|
|
|
|
|
$sPage =~ s/\s*Keine Angaben zum Versand\s*/UNKNOWN/g; |
95
|
|
|
|
|
|
|
# print STDERR $sPage; |
96
|
0
|
|
|
|
|
|
return $self->SUPER::preprocess_results_page($sPage); |
97
|
|
|
|
|
|
|
# print STDERR Dumper($self->{response}); |
98
|
|
|
|
|
|
|
# For debugging: |
99
|
0
|
|
|
|
|
|
print STDERR $sPage; |
100
|
0
|
|
|
|
|
|
exit 88; |
101
|
|
|
|
|
|
|
} # _preprocess_results_page |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _columns |
104
|
|
|
|
|
|
|
{ |
105
|
0
|
|
|
0
|
|
|
my $self = shift; |
106
|
|
|
|
|
|
|
# This is for DE: |
107
|
0
|
|
|
|
|
|
return qw( paypal bids price shipping enddate ); |
108
|
|
|
|
|
|
|
} # _columns |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _process_date_abbrevs |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
0
|
|
|
my $self = shift; |
113
|
0
|
|
|
|
|
|
my $s = shift; |
114
|
|
|
|
|
|
|
# Convert German abbreviations for units of time to something |
115
|
|
|
|
|
|
|
# Date::Manip can parse (namely, English words): |
116
|
0
|
|
|
|
|
|
$s =~ s!(\d)T!$1 days!; |
117
|
0
|
|
|
|
|
|
$s =~ s!(\d)Std\.?!$1 hours!; |
118
|
0
|
|
|
|
|
|
$s =~ s!(\d)Min\.?!$1 minutes!; |
119
|
0
|
|
|
|
|
|
return $s; |
120
|
|
|
|
|
|
|
} # _process_date_abbrevs |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
__END__ |