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!!!
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'], );
create a caoliu object,like as:
my $caoliu = App::Caoliu->new;
reap the file which should be downloaded.
set this will make the md5 path:
$caoliu->require_md5_path(1); say $caoliu->require_md5_path;
set the caoliu proxy address
$caoliu->proxy('127.0.0.1:8087'); say $caoliu->proxy;
set or get the caoliu downloader object:
say $caoliu->downloader; $caoliu->downloader( App::Caoliu::Downloader->new );
set or get the caoliu parser object
$caoliu->parser; $caoliu->parser( App::Caoliu::Parser->new );
set or get target path
$caoliu->target('/tmp'); $caoliu->target;
set or get category
$caoliu->category; $caoliu->category([qw(wuma youma)]);
set App::caoliu log
$caoliu->log->debug("hello world"); $caoliu->log->path('/tmp'); $caoliu->log->level('debug');
To install App::Caoliu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Caoliu
CPAN shell
perl -MCPAN -e shell install App::Caoliu
For more information on module installation, please visit the detailed CPAN module installation guide.