mirror of
https://github.com/adef17286-sudo/KIJK_dl.git
synced 2025-10-13 17:18:10 +00:00
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
import sys
|
|
import subprocess
|
|
|
|
def main():
|
|
args = sys.argv[1:]
|
|
|
|
savename = None
|
|
if '--save-name' in args:
|
|
idx = args.index('--save-name')
|
|
if idx + 1 < len(args):
|
|
savename = args[idx + 1]
|
|
args = args[:idx] + args[idx+2:]
|
|
|
|
tasks_result = subprocess.run([sys.executable, 'tasks.py'] + args, capture_output=True, text=True)
|
|
dash_link = None
|
|
for line in tasks_result.stdout.splitlines():
|
|
if line.startswith("DASH Link:"):
|
|
dash_link = line[len("DASH Link:"):].strip()
|
|
break
|
|
|
|
get_result = subprocess.run([sys.executable, 'keys.py'] + args, capture_output=True, text=True)
|
|
get_output = get_result.stdout.strip()
|
|
|
|
string = f"DASH Link: {dash_link}\n{get_output}" if dash_link else get_output
|
|
|
|
print(string)
|
|
if savename:
|
|
print(savename)
|
|
|
|
command = [
|
|
'N_m3u8dl-re',
|
|
'-sv', 'best',
|
|
'-sa', 'best',
|
|
'--key', string,
|
|
]
|
|
if savename:
|
|
command.extend(['--save-name', savename])
|
|
if dash_link:
|
|
command.append(dash_link)
|
|
|
|
try:
|
|
subprocess.run(command, check=True)
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"Error running N_m3u8dl-re: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|