mirror of
https://github.com/NohamR/OqeeRewind.git
synced 2026-08-26 10:12:08 +00:00
optimize DASH probing and segment download paths
- Switch bruteforce probes from GET to HEAD to avoid downloading full segment bodies (only the status code is needed) - Cap bruteforce concurrency with a semaphore (default 100) instead of issuing one task per tick, and cancel leftover tasks on early exit - Reuse a single aiohttp session / event loop for the manifest mode's AVC/HEVC/audio bruteforces to keep TCP connections alive - Hoist the per-request segment headers into a module-level constant - Use a set for the already-downloaded resume check in save_segments - Replace read()-into-memory copies with shutil.copyfileobj in merge_segments and decrypt
This commit is contained in:
@@ -39,7 +39,7 @@ def merge_segments(input_folder: str, track_id: str, output_file: str):
|
||||
with open(output_file, "wb") as outfile:
|
||||
for fname in segment_files:
|
||||
with open(f"{segment_folder}/{fname}", "rb") as infile:
|
||||
outfile.write(infile.read())
|
||||
shutil.copyfileobj(infile, outfile)
|
||||
logger.info("Merged segments into %s", output_file)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ def decrypt(segment_dir, init_path, output_file, key):
|
||||
with open(chunk_merged, "wb") as outfile:
|
||||
for fname in chunk_files:
|
||||
with open(os.path.join(segment_dir, fname), "rb") as infile:
|
||||
outfile.write(infile.read())
|
||||
shutil.copyfileobj(infile, outfile)
|
||||
|
||||
logger.debug("Decrypting chunk %d", chunk_num)
|
||||
result = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user