App-Caoliu
view release on metacpan or search on metacpan
if ($verbose) {
$c->log->path('');
$c->log->level('debug');
}
else {
$c->log->level('info');
}
if ($link) {
my $post_href =
$c->parser->parse_post( $c->downloader->ua->get($link)->res->body );
say dumper($post_href) ;
my $file = $c->downloader->download_torrent( $post_href->{rmdown_link},
$c->target, { md5_dir => 0 } );
say dumper($post_href) if $verbose;
print "get $file success!\n";
exit;
}
if ( not @finds ) {
die "we now only support wuma,youma,oumei\n";
}
$c->log->debug( "I want to reap" . dumper( $c->category ) );
my @posts = $c->reap;
# if you want to see the image,just download image here
lib/App/Caoliu.pm view on Meta::CPAN
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'],
);
lib/App/Caoliu.pm view on Meta::CPAN
=head1 reap
reap the file which should be downloaded.
=head1 require_md5_path
set this will make the md5 path:
$caoliu->require_md5_path(1);
say $caoliu->require_md5_path;
=head1 proxy
set the caoliu proxy address
$caoliu->proxy('127.0.0.1:8087');
say $caoliu->proxy;
=head1 downloader
set or get the caoliu downloader object:
say $caoliu->downloader;
$caoliu->downloader( App::Caoliu::Downloader->new );
=head1 parser
set or get the caoliu parser object
$caoliu->parser;
$caoliu->parser( App::Caoliu::Parser->new );
=head1 target
lib/App/Caoliu/Parser.pm view on Meta::CPAN
=head1 NAME
App::Caoliu::Parser
=head1 SYNOPSIS
my $p = App::Caoliu::Parser->new;
$p->parse_rss($rss_xml);
$p->parse_post($post_html);
$p->log->debug("say something");
=AUTHOR
=cut
( run in 0.836 second using v1.01-cache-2.11-cpan-a1f116cd669 )