WWW::Search::Ebay::DE - backend for searching auctions at www.ebay.de


WWW-Search-Ebay-Europe documentation Contained in the WWW-Search-Ebay-Europe distribution.

Index


Code Index:

NAME

Top

WWW::Search::Ebay::DE - backend for searching auctions at www.ebay.de

SYNOPSIS

Top

  use WWW::Search;
  my $oSearch = new WWW::Search('Ebay::DE');
  my $sQuery = WWW::Search::escape_query("Yakface");
  $oSearch->native_query($sQuery);
  while (my $oResult = $oSearch->next_result())
    { print $oResult->url, "\n"; }

DESCRIPTION

Top

Acts just like WWW::Search::Ebay.

AUTHOR

Top

Martin 'Kingpin' Thurn, mthurn at cpan.org, http://tinyurl.com/nn67z.

preprocess_results_page

Tweak the HTML to make it easy to parse


WWW-Search-Ebay-Europe documentation Contained in the WWW-Search-Ebay-Europe distribution.
# $Id: DE.pm,v 2.102 2010-03-31 03:37:34 Martin Exp $

package WWW::Search::Ebay::DE;

use strict;
use warnings;

use Carp;
use base 'WWW::Search::Ebay';
our
$VERSION = do { my @r = (q$Revision: 2.102 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };

sub _native_setup_search
  {
  my ($self, $native_query, $rhOptsArg) = @_;
  $rhOptsArg ||= {};
  unless (ref($rhOptsArg) eq 'HASH')
    {
    carp " --- second argument to _native_setup_search should be hashref, not arrayref";
    return undef;
    } # unless
  $rhOptsArg->{search_host} = 'http://search.ebay.de';
  return $self->SUPER::_native_setup_search($native_query, $rhOptsArg);
  } # _native_setup_search

# This is what we look_down for to find the HTML element that contains
# the result count:
sub _result_count_element_specs_NOT_NEEDED
  {
  return (
          '_tag' => 'p',
          class => 'count'
         );
  } # _result_count_element_specs


sub _result_count_pattern
  {
  return qr'(\d+)\s+(Artikel|Ergebnisse)\s+gefunden ';
  } # _result_count_pattern

sub _next_text
  {
  # The text of the "Next" button, localized:
  return 'Weiter';
  } # _next_text

sub _currency_pattern
  {
  # A pattern to match all possible currencies found in eBay listings
  # (if one character looks weird, it's really a British Pound symbol
  # but Emacs shows it wrong):
  return qr{(?:US\s?\$|£|EUR)}; # } } # Emacs indentation bugfix
  } # _currency_pattern

sub preprocess_results_page
  {
  my $self = shift;
  my $sPage = shift;
  # Make it easy to parse the shipping portion of the list:
  $sPage =~ s!(<span\s(class="ship[^"]*")>)!</td><td $2>$1!g;
  # print STDERR $sPage;
  return $self->SUPER::preprocess_results_page($sPage);
  # print STDERR Dumper($self->{response});
  # For debugging:
  print STDERR $sPage;
  exit 88;
  } # _preprocess_results_page

sub _columns
  {
  my $self = shift;
  # This is for DE:
  return qw( seller paypal bids price shipping enddate );
  } # _columns

sub _process_date_abbrevs
  {
  my $self = shift;
  my $s = shift;
  # Convert German abbreviations for units of time to something
  # Date::Manip can parse (namely, English words):
  $s =~ s!(\d)T!$1 days!;
  $s =~ s!(\d)Std\.?!$1 hours!;
  $s =~ s!(\d)Min\.?!$1 minutes!;
  return $s;
  } # _process_date_abbrevs


1;

__END__