2021-05-13 15:26:05 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
|
|
import re
|
2022-01-12 16:15:35 +00:00
|
|
|
import subprocess
|
2021-05-13 15:26:05 +00:00
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
|
2022-11-13 17:24:28 +00:00
|
|
|
import requests
|
|
|
|
|
2021-05-13 15:26:05 +00:00
|
|
|
parser = argparse.ArgumentParser()
|
2022-11-13 17:24:28 +00:00
|
|
|
parser.add_argument("url", help="url from anime-ultime.net")
|
2021-05-13 15:26:05 +00:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
nextHop = True
|
|
|
|
url = args.url
|
2022-11-13 17:24:28 +00:00
|
|
|
root_url = "http://www.anime-ultime.net"
|
2021-05-13 15:26:05 +00:00
|
|
|
|
|
|
|
while nextHop:
|
|
|
|
r1 = requests.get(url)
|
2022-11-13 17:24:28 +00:00
|
|
|
m1 = re.search("javascript:open_ddlbox('dl_orig', '([0-9]+)', 'orig')", r1.text)
|
|
|
|
m2 = re.search('submit.*:right;.*(info-0-1)/([0-9]+)/([^"]+)', r1.text)
|
|
|
|
|
|
|
|
if m1 is None:
|
|
|
|
break
|
|
|
|
|
2022-01-12 16:15:35 +00:00
|
|
|
requests.post(
|
2022-11-13 17:24:28 +00:00
|
|
|
f"{root_url}/ddl/authorized_download.php",
|
|
|
|
data={"idfile": m1.group(1), "type": "orig"},
|
2022-01-12 16:15:35 +00:00
|
|
|
)
|
2021-05-13 15:26:05 +00:00
|
|
|
|
|
|
|
timeout = 46
|
|
|
|
while timeout > 0:
|
2022-11-13 17:24:28 +00:00
|
|
|
sys.stdout.write("\r")
|
2021-05-13 15:26:05 +00:00
|
|
|
sys.stdout.flush()
|
2022-11-13 17:24:28 +00:00
|
|
|
sys.stdout.write(f"Waiting {timeout} seconds ...")
|
2021-05-13 15:26:05 +00:00
|
|
|
timeout = timeout - 1
|
|
|
|
time.sleep(1)
|
|
|
|
|
2022-01-12 16:15:35 +00:00
|
|
|
r2 = requests.post(
|
2022-11-13 17:24:28 +00:00
|
|
|
f"{root_url}/ddl/authorized_download.php",
|
|
|
|
data={"idfile": m1.group(1), "type": "orig"},
|
2022-01-12 16:15:35 +00:00
|
|
|
)
|
2021-05-13 15:26:05 +00:00
|
|
|
j = r2.json()
|
2022-11-13 17:24:28 +00:00
|
|
|
subprocess.call(
|
|
|
|
f"wget -c -t 0 --content-disposition {root_url}{j['link']}", shell=True
|
|
|
|
)
|
2022-01-12 16:15:35 +00:00
|
|
|
|
2021-05-13 15:26:05 +00:00
|
|
|
if m2 is None:
|
|
|
|
nextHop = False
|
2022-11-13 17:24:28 +00:00
|
|
|
sys.stdout.write("\r")
|
2021-05-13 15:26:05 +00:00
|
|
|
sys.stdout.flush()
|
|
|
|
else:
|
2022-11-13 17:24:28 +00:00
|
|
|
url = f"{root_url}/{m2.group(1)}/{m2.group(2)}/{m2.group(3)}"
|