Michel Roux
476105c824
All checks were successful
continuous-integration/drone/push Build is passing
53 lines
1.3 KiB
Python
Executable File
53 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import argparse
|
|
import re
|
|
import requests
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('url', help="url from anime-ultime.net")
|
|
args = parser.parse_args()
|
|
|
|
nextHop = True
|
|
url = args.url
|
|
root_url = 'http://www.anime-ultime.net'
|
|
|
|
while nextHop:
|
|
r1 = requests.get(url)
|
|
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
|
|
)
|
|
requests.post(
|
|
root_url + '/ddl/authorized_download.php',
|
|
data={'idfile': m1.group(1), 'type': 'orig'}
|
|
)
|
|
|
|
timeout = 46
|
|
while timeout > 0:
|
|
sys.stdout.write('\r')
|
|
sys.stdout.flush()
|
|
sys.stdout.write('Waiting ' + str(timeout) + ' seconds ...')
|
|
timeout = timeout - 1
|
|
time.sleep(1)
|
|
|
|
r2 = requests.post(
|
|
root_url + '/ddl/authorized_download.php',
|
|
data={'idfile': m1.group(1), 'type': 'orig'}
|
|
)
|
|
j = r2.json()
|
|
subprocess.call('wget -c -t 0 --content-disposition "' +
|
|
root_url + j['link'] + '"', shell=True)
|
|
|
|
if m2 is None:
|
|
nextHop = False
|
|
sys.stdout.write('\r')
|
|
sys.stdout.flush()
|
|
else:
|
|
url = root_url + '/' + \
|
|
m2.group(1) + '/' + m2.group(2) + '/' + m2.group(3)
|