-
-
Save z448/50cbe923d2c0f68d21472044317fd8dd to your computer and use it in GitHub Desktop.
search torrent from CLI, filter results based on seeders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use HTTP::Tiny; | |
use JSON::PP; | |
use Term::ANSIColor; | |
my $help = <<'EOT'; | |
USAGE: trrtool keyword1 keyword2 keywordN <-Nr> | |
ex: trrtool big lebowski <-- search torrents containing big lebowski keywords non case sensitive | |
ex: trrtool big lebowski -10 <-- same as above but limit results where seeders > 10 | |
EOT | |
say $help unless @ARGV; | |
my $term = `tput cols`; | |
my $seeds = 1; $seeds = $ARGV[$#ARGV] if $ARGV[$#ARGV] =~ /^-/; $seeds =~ s/-//; | |
my $url = 'http://extratorrent.cc/json/?cid=4&search=' . join '+', @ARGV; | |
my $response = HTTP::Tiny->new->get($url); | |
my $t = decode_json $response->{content}; | |
my @t = grep { $_->{seeds} > $seeds } @{$t->{list}}; | |
#print Dumper(@t) and die if $seeds eq '-'; | |
say colored(['yellow'], $_->{title}) . "\t" . colored(['red'], $_->{torrentLink}) . "\t" . colored(['red'],$_->{seeds}) . "\t" . $_->{size} . 'M' for @t; | |
#print Dumper ($t); | |
__DATA__ | |
OSX /Applications/WebTorrent.app/Contents//MacOS/WebTorrent | |
$VAR1 = { | |
'link' => 'http://extratorrent.cc', | |
'description' => 'Extratorrent Search: big lebowski', | |
'title' => 'Extratorrent Search: big lebowski', | |
'list' => [ | |
{ | |
'files' => 17, | |
'torrentLink' => 'http://extratorrent.cc/download/2277121/', | |
'leechs' => -1, | |
'link' => 'http://extratorrent.cc/torrent/2277121/', | |
'hash' => 'b7cbd4a6be50403f17df469f3759d17a82ee6c28', | |
'category' => 'Movies', | |
'subcategory' => 'Comedy', | |
'seeds' => -1, | |
], | |
'total_results' => 73 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment