Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Community Cafe (http://www.bvlist.com/forumdisplay.php?f=18)
-   -   Torrent Auto upload bot (http://www.bvlist.com/showthread.php?t=12377)

firefly007 18th June 2021 11:26

Torrent Auto upload bot by firefly
 
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

onebit 29th October 2021 21:10

not working
Quote:

Originally Posted by firefly007 (Post 55569)
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


firefly007 1st November 2021 15:11

What error are u getting?

BamBam0077 23rd July 2022 15:33

QUESTION: STILL AVAILABLE TO GET WORK FOR UBUNTU SERVER FOR TBDEV09 DEFAULT VALUE SETUP? :gum:

Don't have a demo server available to look into further studies at this current time as traveling to university tomorrow :ok:


All times are GMT +2. The time now is 00:23.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.