| 1 | |||
| 2 | package WWW::Search::Ebay::FR; | ||
| 3 | |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | our | ||
| 8 | 1 | $VERSION = 2.106; | |
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | WWW::Search::Ebay::FR - backend for searching auctions at eBay France | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | use WWW::Search; | ||
| 17 | my $oSearch = new WWW::Search('Ebay::FR'); | ||
| 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<mthurn at cpan.org>, L<http://tinyurl.com/nn67z>. | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 1 | ▶ | use WWW::Search::Ebay 2.258; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 1 | ▶ | use base 'WWW::Search::Ebay'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | sub _native_setup_search | ||
| 38 | 2 | ▶ | { |
|
Subroutine
_native_setup_search: called CC=1 SCAR=0.0
| |||
| 39 | 2 | my ($self, $native_query, $rhOptsArg) = @_; | |
| 40 | 2 | $self->{search_host} = 'http://www.ebay.fr'; | |
| 41 | 2 | 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 | ||
| 47 | 0 | ▶ | { |
|
Subroutine
_result_count_element_specs: not called CC=1 SCAR=6.9
| |||
| 48 | return ( | ||
| 49 | 0 | '_tag' => 'span', | |
| 50 | class => 'smuy' | ||
| 51 | ); | ||
| 52 | } # _result_count_element_specs | ||
| 53 | |||
| 54 | sub _result_count_pattern | ||
| 55 | 0 | ▶ | { |
|
Subroutine
_result_count_pattern: not called CC=1 SCAR=6.9
| |||
| 56 | 0 | return qr'(\d+)\s+(?:résultat|objet|annonce)'i; | |
| 57 | } # _result_count_pattern | ||
| 58 | |||
| 59 | |||
| 60 | sub _next_text | ||
| 61 | 0 | ▶ | { |
|
Subroutine
_next_text: not called CC=1 SCAR=6.9
| |||
| 62 | # The text of the "Next" button, localized: | ||
| 63 | 0 | return 'Suivante'; | |
| 64 | } # _next_text | ||
| 65 | |||
| 66 | sub _title_pattern | ||
| 67 | 0 | ▶ | { |
|
Subroutine
_title_pattern: not called CC=1 SCAR=6.9
| |||
| 68 | 0 | my $self = shift; | |
| 69 | 0 | return qr{\A(.+?)\s+EN\s+VENTE\s+SUR\s+EBAY\.FR\s+()\(FIN\s+LE\s+([^)]+)\)}i; | |
| 70 | } # _title_pattern | ||
| 71 | |||
| 72 | sub _currency_pattern | ||
| 73 | 1 | ▶ | { |
|
Subroutine
_currency_pattern: called CC=1 SCAR=0.0
| |||
| 74 | 1 | my $self = shift; | |
| 75 | # A pattern to match all possible currencies found in eBay listings | ||
| 76 | 1 | my $W = $self->whitespace_pattern; | |
| 77 | 1 | return qr{[\d.,]+$W+EUR}; # } } # Emacs indentation bugfix | |
| 78 | } # _currency_pattern | ||
| 79 | |||
| 80 | sub _preprocess_results_page_OFF | ||
| 81 | 0 | ▶ | { |
|
Subroutine
_preprocess_results_page_OFF: not called CC=1 SCAR=6.9
| |||
| 82 | 0 | my $self = shift; | |
| 83 | 0 | my $sPage = shift; | |
| 84 | # print STDERR Dumper($self->{response}); | ||
| 85 | # For debugging: | ||
| 86 | 0 | print STDERR $sPage; | |
| 87 | 0 | exit 88; | |
| 88 | } # _preprocess_results_page | ||
| 89 | |||
| 90 | sub _columns | ||
| 91 | 0 | ▶ | { |
|
Subroutine
_columns: not called CC=1 SCAR=6.9
| |||
| 92 | 0 | my $self = shift; | |
| 93 | # This is for FR: | ||
| 94 | 0 | return qw( paypal bids price repeat shipping enddate ); | |
| 95 | } # _columns | ||
| 96 | |||
| 97 | sub _process_date_abbrevs | ||
| 98 | 0 | ▶ | { |
|
Subroutine
_process_date_abbrevs: not called CC=1 SCAR=6.9
| |||
| 99 | 0 | my $self = shift; | |
| 100 | 0 | my $s = shift; | |
| 101 | # Convert French abbreviations for units of time to something | ||
| 102 | # Date::Manip can parse (namely, English words): | ||
| 103 | 0 | $s =~ s!(\d)j!$1 days!; | |
| 104 | 0 | $s =~ s!(\d)h!$1 hours!; | |
| 105 | 0 | $s =~ s!(\d)m!$1 minutes!; | |
| 106 | 0 | return $s; | |
| 107 | } # _process_date_abbrevs | ||
| 108 | |||
| 109 | |||
| 110 | 1 | 1; | |
| 111 | |||
| 112 | __END__ | ||