mirror of
https://github.com/adef17286-sudo/KIJK_dl.git
synced 2025-11-03 21:04:50 +00:00
Update dl.py
This commit is contained in:
parent
b27f2c7223
commit
f24fa2d3a1
28
dl.py
28
dl.py
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
@ -9,9 +10,11 @@ def main():
|
|||||||
idx = args.index('--save-name')
|
idx = args.index('--save-name')
|
||||||
if idx + 1 < len(args):
|
if idx + 1 < len(args):
|
||||||
savename = args[idx + 1]
|
savename = args[idx + 1]
|
||||||
args = args[:idx] + args[idx+2:]
|
args = args[:idx] + args[idx + 2:]
|
||||||
|
|
||||||
|
# Execute tasks.py and get the DASH link
|
||||||
tasks_result = subprocess.run([sys.executable, 'tasks.py'] + args, capture_output=True, text=True)
|
tasks_result = subprocess.run([sys.executable, 'tasks.py'] + args, capture_output=True, text=True)
|
||||||
|
|
||||||
dash_link = None
|
dash_link = None
|
||||||
for line in tasks_result.stdout.splitlines():
|
for line in tasks_result.stdout.splitlines():
|
||||||
if line.startswith("DASH Link:"):
|
if line.startswith("DASH Link:"):
|
||||||
@ -21,29 +24,30 @@ def main():
|
|||||||
get_result = subprocess.run([sys.executable, 'keys.py'] + args, capture_output=True, text=True)
|
get_result = subprocess.run([sys.executable, 'keys.py'] + args, capture_output=True, text=True)
|
||||||
get_output = get_result.stdout.strip()
|
get_output = get_result.stdout.strip()
|
||||||
|
|
||||||
string = f"DASH Link: {dash_link}\n{get_output}" if dash_link else get_output
|
# Extract only the key part from get_output
|
||||||
|
key_part = get_output.split(':', 1)[0] + ':' + get_output.split(':', 1)[1].strip()
|
||||||
|
|
||||||
print(string)
|
print(f"Executing command with key: {key_part}")
|
||||||
if savename:
|
|
||||||
print(savename)
|
|
||||||
|
|
||||||
|
# Prepare the command
|
||||||
command = [
|
command = [
|
||||||
'N_m3u8dl-re',
|
'N_m3u8dl-re',
|
||||||
'-sv', 'best',
|
'-M', 'mp4',
|
||||||
'-sa', 'best',
|
'-sv', 'best',
|
||||||
'--key', string,
|
'-sa', 'best',
|
||||||
'--use-shaka-packager',
|
'--key', key_part,
|
||||||
]
|
]
|
||||||
if savename:
|
|
||||||
command.extend(['--save-name', savename])
|
# Append the dash_link without additional quotes
|
||||||
if dash_link:
|
if dash_link:
|
||||||
command.append(dash_link)
|
command.append(dash_link)
|
||||||
|
|
||||||
|
# Run the N_m3u8dl-re command
|
||||||
try:
|
try:
|
||||||
|
print("Running command...")
|
||||||
subprocess.run(command, check=True)
|
subprocess.run(command, check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error running N_m3u8dl-re: {e}")
|
print(f"Error running N_m3u8dl-re: {e}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user