use FindBin qw($Bin); use lib "$Bin/../lib"; use strict; use warnings; use File::Basename; use App::Caoliu; use Mojo::Log; use App::Caoliu::Utils 'dumper'; use 5.010; use Getopt::Long; my $usage = < \$category, "directory|d=s" => \$dir, "verbose|v" => \$verbose, "help|h" => \$help, "img|i" => \$image, "l|link=s" => \$link, "proxy|p=s" => \$proxy, ) or die $usage; if ($help) { print $usage; exit; } my @finds = grep { /wuma|youma|oumei/ } split( ',', $category ) if $category; my $c = App::Caoliu->new(proxy => '127.0.0.1:8087'); if ($proxy) { $c->downloader->ua->http_proxy('http://sri:secret@'.$proxy) } if (@finds) { $c->category( [@finds] ); } if ($dir) { $c->target($dir); } 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 if ($image) { for (@posts) { if ( $_->{bt} ) { $c->downloader->download_image( path => dirname( $_->{bt} ), imgs => $_->{preview_imgs} ); } } } $c->log->debug( "got all file:" . dumper( \@posts ) ); exit 0; __END__ =pod =cut