Code:
- #!/usr/bin/perl
############################ Semi auto upload bot bot by firefly dan.oak44@gmail.com #############################
# Please note! You do not need to follow steps 3,4,5 if you are using Janis's script.
# You need rutorrent installed
# Create a new file called bot.pl and save it in /home/user/ and chown and chmod it
#1 You will need CPAN module LWP::Simple and WWW::Mechanize
#2 You also need Mktorrent apt-get install mktorent
#3 You will also need to uncommand this line in your rtorrent.rc
#4 schedule = watch_directory,5,5,load_start=./watch/*.torrent
#5 Then create a new folder in your rutorrent home folder where rutorrent is installed and chown and chmod.
#6 Then edit the paths and login details make sure you leave out or add paths where needed
# This is built for TBDEV but is very easy to mod you will need to check the Login section and Upload section.
# USAGE: ./bot.pl [name] [10] [PATH/TO/RELEASE/FOLDER] Remember to point to folder not file inside other wise it will not seed.
use strict;
use warnings;
use WWW::Mechanize;
##
my $username = "admin"; #Your tracker username
my $password = "******"; #Your tracker password
my $site_url = "http://ninjacentral.co.za"; #Tracker URL NO ending slash
my $announce = "http://ninjacentral.co.za/announce.php?passkey=595c9cffd32c31142064f775f0eee520"; #Announce URl NO ending slash
my $watch = "/home/bot/watch/"; #Watch folder MUST add ending slash
my $num_args = $#ARGV + 1;
if ($num_args != 3) {
print "\nCommand!: {RELEASE.NAME} {CAT_ID} {/home/user/downloads/RELEASE.NAME or FOLDER.NAME}
\n";
print "\nUsage: ./auto.pl Ancient.Black.Ops.S01E03.HDTV.XviD-AFG 50 /home/user/downloads/Ancient.Black.Ops.S01E03.HDTV.XviD-AFG.avi
\n";
exit;
}
my $name=$ARGV[0];
my $cat=$ARGV[1];
my $tor=$ARGV[2];
system ("mktorrent -p -a $announce -o $watch$name.torrent $tor");
# LOGIN
my $mech = WWW::Mechanize->new( autocheck => 1 ); #Initializes WWW::Mechanize
$mech->get("$site_url/login.php"); #Retrieves The Login Page
print "Logging Into site, Please Wait.\n"; #Alerts The User
$mech->submit_form( #Logs Us In
form_number => 0,
fields => {
username => "$username",
password => "$password",
}
);
# Upload
my $content = "$watch$name.torrent";
$mech->get("$site_url/upload.php"); #Loads Upload Page Into Mech
$mech->field('file', $content);
$mech->field('name', $name);
$mech->field('descr', "Will be added later");
$mech->field('type', $cat);
$mech->click();
Bump: So I needed to make some modifications for order to get around "This torrent isn't registered with the tracker".
Please note! If your tracker download path looks like this download/12/some.torrent.torrent then you will need to modify regex around line 78, If you need help just shout!
Code:
#!/usr/bin/perl
############################ Semi auto upload bot, bot by firefly dan.oak44@gmail.com #############################
# Please note! You do not need to follow steps 3,4,5 if you are using Janis's script.
# Create a new file called bot.pl and save it in /home/user/ and chown and chmod it
#1 You will need CPAN module LWP::Simple and WWW::Mechanize
#2 You also need Mktorrent apt-get install mktorent
#3 You will also need to uncommand this line in your rtorrent.rc
#4 schedule = watch_directory,5,5,load_start=./watch/*.torrent
#5 Then create a new folder in your home folder where rutorrent is installed and chown and chmod.
#6 Then edit the paths and login details make sure you leave out or add paths where needed
# This is built for TBDEV but is very easy to mod you will need to check the Login section and Upload section.
# USAGE: ./bot.pl [name] [10] [PATH/TO/RELEASE/FOLDER] Remember to point to folder not file inside other wise it will not seed.
use strict;
use warnings;
use WWW::Mechanize;
##
my $username = "firefly"; #Your tracker username
my $password = "5821374"; #Your tracker password
my $site_url = "http://freakleech.net"; #Tracker URL NO ending slash
my $announce = "http://ann.fln.si/announce.php?passkey=7602dabe6e6b5f4e56d7a99f70a992dd"; #Announce URl NO ending slash
my $tempwatch = "/home/bot2/tempwatch/"; #Watch folder MUST add ending slash
my $watch = "/home/bot/watch/"; #Watch folder MUST add ending slash
my $download = "/home/bot2/Downloads";
my $num_args = $#ARGV + 1;
if ($num_args != 3) {
print "\nCommand!: {RELEASE.NAME} {CAT_ID} {/home/user/downloads/RELEASE.NAME or FOLDER.NAME}
\n";
print "\nUsage: ./auto.pl Ancient.Black.Ops.S01E03.HDTV.XviD-AFG 50 /home/user/downloads/Ancient.Black.Ops.S01E03.HDTV.XviD-AFG
\n";
exit;
}
my $name=$ARGV[0];
my $cat=$ARGV[1];
my $tor=$ARGV[2];
my $namepre = "[FLN].$name";
system ("mktorrent -p -a $announce -o $tempwatch$name.torrent $tor");
#system (" ./rtorrent_fast_resume.pl $download < $tempwatch$namepre.torrent > $watch$namepre.torrent");
# LOGIN
my $mech = WWW::Mechanize->new();
$mech->get("$site_url/login.php");
print "Logging Into site, Please Wait.\n"; #Alerts The User
$mech->form_number(2);
$mech->field('username', $username);
$mech->field('password', $password);
$mech->submit();
# Upload
my $content = "$tempwatch$name.torrent";
print "Uploading..., Please Wait.\n"; #Alerts The User
$mech->get("$site_url/upload.php"); #Loads Upload Page Into Mech
$mech->field('file', $content);
$mech->field('name', $name);
$mech->field('descr', "Will be added later");
$mech->field('type', $cat);
$mech->click();
my $txt = $mech->content;
my $re1='(download.php\?id\=[1-9][0-9]*)'; #Get download and id
my $re=$re1;
if ($txt =~ m/$re/is)
{
my $int1=$1;
my $rexout = "$int1 \n";
print $rexout;
my $url = "$site_url/$rexout&hit=1";
my $local_file_name = "$watch$name.torrent";
$mech->get($url, ":content_file" => $local_file_name );
}
print $mech->content;