Skip to content

Instantly share code, notes, and snippets.

@ishiduca
Created June 17, 2011 04:30
Show Gist options
  • Save ishiduca/1030874 to your computer and use it in GitHub Desktop.
Save ishiduca/1030874 to your computer and use it in GitHub Desktop.
ブラウザのCookieを使ってDLする
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Cookies::Safari;
use WWW::Pixiv::Download;
my $illust_id = shift || die qq(! failed: "illust_id" not found.\n);
my $cookie_jar = HTTP::Cookies::Safari->new;
$cookie_jar->load( "$ENV{HOME}/Library/Cookies/Cookies.plist" );
my $client = WWW::Pixiv::Download->new;
$client->user_agent->cookie_jar( $cookie_jar );
$client->download($illust_id);
__END__
ブラウザ(この場合サファリ)のCookieを使ってログイン状態にもっていく。
$client->login を省略する分速いかというと、Cookieの読み込みが重かったりして、、、
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment