Update downloader_audio.py

This commit is contained in:
GladistonXD
2026-02-05 20:26:05 -03:00
committed by GitHub
parent f13fb97f53
commit 0ebcf15f91
+19 -9
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import subprocess
import time
from pathlib import Path
from Crypto.Cipher import AES
@@ -92,16 +93,25 @@ class DownloaderAudio:
return stream_info
def get_decryption_key(self, stream_info: StreamInfoAudio) -> str:
if self.audio_quality in AAC_AUDIO_QUALITIES:
_, decryption_key = self.downloader.get_widevine_decryption_key(
stream_info.widevine_pssh,
"audio",
)
else:
decryption_key = self.downloader.get_playplay_decryption_key(
stream_info.file_id
)
decryption_key = None
for attempt in range(10):
try:
if self.audio_quality in AAC_AUDIO_QUALITIES:
_, decryption_key = self.downloader.get_widevine_decryption_key(
stream_info.widevine_pssh,
"audio",
)
else:
decryption_key = self.downloader.get_playplay_decryption_key(
stream_info.file_id
)
if decryption_key:
return decryption_key
except Exception as e:
time.sleep(attempt + 10)
return decryption_key
def download_stream_url(self, input_path: Path, stream_url: str):