Compare commits

..

No commits in common. "a22b65f0f85c6c2f93ef17e748fb552a0bb1495b" and "b27f2c72230933d4173fe16b3d62e3f1a862439d" have entirely different histories.

2 changed files with 14 additions and 16 deletions

View File

@ -1,3 +1,5 @@
Onderhoud: moet waarschijnlijk ergens een paar seconden wachten voor mpd url bruikbaar is (werkt half)
simpele downloader voor KIJK DISCLAMER: ALLEEN BEDOELT VOOR EDUCATIEVE DOELEINDEN IK STEL MIJZELF NIET VERANDWOORDERLIJK VOOR WAT JIJ HIERMEE DOET DOWNLOAD ALLEEN ALS DAT OOK MAG simpele downloader voor KIJK DISCLAMER: ALLEEN BEDOELT VOOR EDUCATIEVE DOELEINDEN IK STEL MIJZELF NIET VERANDWOORDERLIJK VOOR WAT JIJ HIERMEE DOET DOWNLOAD ALLEEN ALS DAT OOK MAG
getest op win 10 (met wat aanpassingen zou hij vast ook wel werken op Linux) getest op win 10 (met wat aanpassingen zou hij vast ook wel werken op Linux)

22
dl.py
View File

@ -1,4 +1,3 @@
import os
import sys import sys
import subprocess import subprocess
@ -12,9 +11,7 @@ def main():
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:"):
@ -24,30 +21,29 @@ 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()
# Extract only the key part from get_output string = f"DASH Link: {dash_link}\n{get_output}" if dash_link else get_output
key_part = get_output.split(':', 1)[0] + ':' + get_output.split(':', 1)[1].strip()
print(f"Executing command with key: {key_part}") print(string)
if savename:
print(savename)
# Prepare the command
command = [ command = [
'N_m3u8dl-re', 'N_m3u8dl-re',
'-M', 'mp4',
'-sv', 'best', '-sv', 'best',
'-sa', 'best', '-sa', 'best',
'--key', key_part, '--key', string,
'--use-shaka-packager',
] ]
if savename:
# Append the dash_link without additional quotes command.extend(['--save-name', savename])
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()