Added support for Magnets!

This commit is contained in:
Soap 2025-10-08 00:03:11 +00:00
parent ca73445114
commit ea50300c14

View File

@ -52,9 +52,8 @@ while you're in the /inc folder (or any folder below there)
def main():
inf = json.loads(sys.argv[1])
url = inf["txt"]
if "://" not in url:
if "://" not in url and url[:6] != 'magnet':
url = "https://" + url
proto = url.split("://")[0].lower()
if proto not in ("http", "https", "ftp", "ftps"):
raise Exception("bad proto {}".format(proto))
@ -73,13 +72,16 @@ def main():
"--downloader-args", "-j 16 -x 8 -s 16 -k 1M",
url
]
print(url[:6])
if url[:6] == 'magnet':
cmd = [cmd[4]] + [cmd[7]]
else:
if '.' in (name[-3], name[-4]) and name[-3:] != 'php':
cmd += ["-o", name]
print(" ".join(cmd) + "\n", end="")
try:
result = sp.run(cmd, stdout=sp.PIPE, stderr=sp.PIPE, text=True)
print("STDOUT:\n" + result.stdout)