NAME App::Caoliu
DESCRIPTION
If you are the fans of 1024 bbs,you should know what I did for it.After you learn this module,you will feel very happy to make communication to 1024 bbs. OK,I don't want to see any more,just follow me step by step. Let's rock!!!
SYNOPSIS
use App::Caoliu;
use 5.010;
# reap the torrent from a category
my $c = App::Caoliu->new( category => ['wuma'],target => '/tmp');
# set proxy,if you have installed go-agent or some other proxy softwares
# because the gfw often suck 1024 bbs
$c->proxy('127.0.0.1:8087');
# when in scalar env ,return the count number of downloaded files
say "total downloaded ".scalar($c->reap)." torrent files";
use App::Caoliu::Utils 'dumper';
# when under list env,return the file list
my @reaped = $c->reap;
# reap only one link;
my $link = 'http://t66y.com/htm_data/2/1309/956691.html';
my $post_href =
$c->parser->parse_post( $c->downloader->ua->get($link)->res->body );
my $file = $c->downloader->download_torrent( $post_href->{rmdown_link},
$c->target, { md5_dir => 0 } );
say "I got the file $file";
# set log
$c->log->path('/tmp/xx.log');
$c->log->level('debug');
# download image
my @images = $c->downloader->download_image(
path => '.',
imgs => ['http://example.com/xx.jpg','http://example.com/yy.jpg'],
);
my $count = $c->downloader->download_image(
path => '.',
imgs => ['http://example.com/xx.jpg','http://example.com/yy.jpg'],
);
new
create a caoliu object,like as:
my $caoliu = App::Caoliu->new;
reap
reap the file which should be downloaded.
require_md5_path
set this will make the md5 path:
$caoliu->require_md5_path(1);
say $caoliu->require_md5_path;
proxy
set the caoliu proxy address
$caoliu->proxy('127.0.0.1:8087');
say $caoliu->proxy;
downloader
set or get the caoliu downloader object:
say $caoliu->downloader;
$caoliu->downloader( App::Caoliu::Downloader->new );
parser
set or get the caoliu parser object
$caoliu->parser;
$caoliu->parser( App::Caoliu::Parser->new );
target
set or get target path
$caoliu->target('/tmp');
$caoliu->target;
category
set or get category
$caoliu->category;
$caoliu->category([qw(wuma youma)]);
log
set App::caoliu log
$caoliu->log->debug("hello world");
$caoliu->log->path('/tmp');
$caoliu->log->level('debug');