View Single Post
  #1  
Old 18th June 2021, 11:26
firefly007's Avatar
firefly007 firefly007 is offline
SUPPORT GURU
 
Join Date: Jun 2010
P2P
Posts: 702
Default Torrent Auto upload bot
1st thing is getting the dependencies.

Run these commands from the terminal.

wget http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py
sudo easy_install requests


place below script in your home directory and make it executable .

Edit your details in.

Open deluge go to plugins enable execute and place the full path to the script
as seen here
http://dev.deluge-torrent.org/wiki/Plugins/Execute

But for completed torrent not added torrent

Then make sure the watch directory is also set in deluge.

(Python2)

bot.py



Code:
#!/usr/bin/python
#Edit theses
username = ""
password = ""
TrackerURL = "http://tracker.com/ninja.php?passkey="
log = "/home/firefly/uploadlog.text"
watchdir = "/home/firefly/watch/"
blocksize = 18 # 2^blocksize | 18^2 = 256kb per block
homedir = "/home/firefly/"
#-------------------------------------------------------------------------------------------------------

import
 sys
from sys import argv

logfile = open(log, 'a')
logfile.write("-----------------------------------------------\n")
try:
    torrentid= argv[1]
    torrentname= argv[2]
    torrentpath= argv[3]
except:
    logfile.write("No args given :(\n")
    logfile.close()
    sys.exit("Not run with Deluge")

logfile.write("New Upload\n")
logfile.write("-----------------------------------------------\n")
logfile.write("Torrent Name: " + torrentname + "\n")
logfile.write("Torrent Path: " + torrentpath + "\n")
mktorrentcmd = "mktorrent -p -a '" + TrackerURL + "' '" + torrentpath + "/" + torrentname + "' "
mktorrentcmd += "-o '" + homedir  + torrentname + ".torrent'"
logfile.write("Making torrent with " + mktorrentcmd + "\n")
import os
os.system(mktorrentcmd)

try:
    import requests
    print "requests loaded" 
except:
    logfile.write("Please install requests\n")
    sys.exit("Missing requests")

url = "http://www.tracker/takelogin.php"
user = {'username' : username, 'password' : password}
UploadURL = "http://tracker/takeupload.php"

try:
    r = requests.post(url, data=user)
    cookies = r.cookies
    logfile.write("Logged in" + mktorrentcmd + "\n")
except:
    print "Ninja not up"
    sys.exit("Missing requests")

torrent_location = homedir  + torrentname + ".torrent"

torrent = {'file': open(torrent_location, 'rb')}
#Upload Crap
data = {"MAX_FILE_SIZE" : 262144, "name" : "",
        "filetype" : 2, "nfo" : "", "artist" : "",
        "ulbum" : "", "year" : "", "format": "",
        "bitrate" : "", "nfo2" : "", "link" : "",
        "descr" : "Description to follow soon <3", "type" : 36}

r = requests.post(UploadURL, cookies=cookies, data=data, files=torrent)

logfile.write("Moving to watch directory: " + "mv '~/" + torrentname + ".torrent' '" + watchdir + torrentname + ".torrent'" + "\n")
os.system("mv '" + homedir + torrentname + ".torrent' '" + watchdir + torrentname + ".torrent'")

logfile.close()
You automate it by setting up auto download + watch folder
__________________

Due to free time I'm able to help interested member's with their tracker.

Please Note!
Depending on your requests I will charge you for my assistance for Tracker installs and mods.
All my mods are custom and prices will very depending on the request.

I'm able to install any tracker and mods including themes.

Please PM me

Reply With Quote