WWW::Hatena::Scraper - Base class to scraping Hatena/Hatelabo Web sites


WWW-Hatena-WanWanWorld documentation  | view source Contained in the WWW-Hatena-WanWanWorld distribution.

Index


SYNOPSIS

Top

    use WWW::Hatena::Scraper;

    ## Simple use for.
    my $whs = WWW::Hatena::Scraper->new;
    my $username = $whs->login('username','password') or die "Login failed!";
    my $content = $whs->get_content("http://www.hatena.ne.jp/");

    ## You can get login cookie and re-login later.
    my $rk = $whs->rk;

    my $whs2 = WWW::Hatena::Scraper->new;
    my $username = $whs2->login($rk) or die "Cookie is invalid or expired!";

    ## If you want to access Hatelabo, do like this:
    my $labo = WWW::Hatena::Scraper->new(labo => 1);
    my $username = $labo->login('username','password') or die "Login failed!";
    my $content = $labo->get_content("http://www.hatelabo.jp/");

    ## Logout.
    $whs->logout;
    $whs2->logout;
    $labo->logout;

DESCRIPTION

Top

WWW::Hatena::Scraper is a client for fetching Hatena and Hatelabo's logined pages.

* https login support

If you have Crypt::SSLeay installed, WWW::Hatena::Scraper will automatically try to login https based login page.

CONSTRUCTOR

Top

new

my $whs = WWW::Hatena::Scraper->new([ %opts ]);

You can set the ua and labo option in constructor.

ua

If you want to reuse LWP::UserAgent object, set it to this option.

labo

If you set this option 1, login to not Hatena(hatena.ne.jp) but Hatelabo (hatelabo.jp).

METHODS

Top

Login to Hatena/Hatelabo web sites. Return value is Hatena user id, and if undef returns, login failed.

Fetch $url's web content. $url must be the page of Hatena/Hatelabo. $content is optional, if given, use POST method, or use GET method.

Logout from Hatena/Hatelabo web sites.

Returns user id if login successed.

Returns login cookie if login successed. Give this value to login method later, you can relogin, unless it hasn't expired.

Returns the last error, in form "errcode: errtext"

Returns the last error code.

Returns the last error text.

COPYRIGHT

Top

WARRANTY

Top

This is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.

SEE ALSO

Top

Hatena website: http://hatena.ne.jp/ Hatelabo website: http://hatelabo.jp/

WWW::Hatena::WanWanWorld -- part of this module

AUTHORS

Top

OHTSUKA Ko-hei <nene@kokogiko.net>


WWW-Hatena-WanWanWorld documentation  | view source Contained in the WWW-Hatena-WanWanWorld distribution.