NAME

WebService::Yes24 - Yes24 Web Service API Module

VERSION

version 0.100980

SYNOPSIS

use 5.010;
use WebService::Yes24;

my $yes24 = WebService::Yes24->new;
$yes24->search( "Learning Perl" );
for my $item ( @{ $yes24->result } ) {
    say $item->{title};
    say $item->{cover};
    say $item->{author};
    say $item->{publisher};
    say $item->{date};
    say $item->{price};
    say $item->{mileage};
    say $item->{link};
}

my $total = $yes24->search( "Learning Perl" );
my $last_page = ($total / $yes24->page_size) + 1;
for my $page ( 1 .. $last_page ) {
    for my $result ( @{ $yes24->result($page) } ) {
        say $item->{title};
        say $item->{cover};
        say $item->{author};
        say $item->{publisher};
        say $item->{date};
        say $item->{price};
        say $item->{mileage};
        say $item->{link};
    }
}

DESCRIPTION

Yes24 (http://www.yes24.com) is a e-commerce company in South Korea. They mainly sell books, CD/DVDs, gifts and etc like Amazon. This module provides APIs to get information from Yes24.

CAUTION

In fact, Yes24 doesn't support API. So, implementation of this module is based on the web scraping, which is the very fragile approach and very slow. Please remember, one day this module might not work! If you find the such situation, let me know. :-)

ATTRIBUTES

category

This attribute stores the category. The available categories are "all", "korean-book" and "foreign-book". The default value is "all".

page_size

This attribute stores the page size. The available page sizes are 20, 40 and 60. The default value is 20.

page

This attribute stores the page number. The minimum page number is 1. The default value is 1.

sort

This attribute stores the sort type. The available sort types are listed below:

- accuracy
- sales
- date
- recommendation
- review
- score
- coupon
- low-price
- high-price
- event
- gift

The default values is 'accuracy'.

sold_out

This attribute stores the boolean value of the availability of sold out products. If this value is set, search result contains the sold out products. The default value is true.

query_type

This attribute stores the query type. The available query types are listed below:

- normal
- author
- publisher
- keyword
- isbn

The default value is 'normal'.

METHODS

new

my $yes24 = WebService::Yes24->new;

This method will create and return WebService::Yes24 object.

If any parameter was not given, the default values are used:

# Same as the above code
my $yes24 = WebService::Yes24->new(
    category   => 'all',
    page_size  => 20,
    page       => 1,
    sort       => 'accuracy',
    sold_out   => 1,
    query_type => 'normal',
);
my $total = $yes24->search('Learning Perl');

This method will start search from Yes24. You have to specify the search keyword as the parameter. It returns total items of the search result.

result

my @items = @{ $yes24->result };

This method will return the items of the search result.

You can set the page number.

my $page_number = 2;
my @items_2 = @{ $yes24->result($page_number) };

If the page number is omitted, then $self->page is used. Above code is same as below:

my $page_number = 2;
$yes24->page($page_number);
my @items_2 = @{ $yes24->result };

AUTHOR

Keedi Kim - 김도형 <keedi at cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Keedi Kim.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.