Обновить test.py
This commit is contained in:
parent
b4131c5980
commit
43de09ad97
11
test.py
11
test.py
@ -34,7 +34,12 @@ def download_video(url):
|
|||||||
return
|
return
|
||||||
if url in failed_downloads:
|
if url in failed_downloads:
|
||||||
print(f"Video {url} previously failed. Retrying.")
|
print(f"Video {url} previously failed. Retrying.")
|
||||||
|
|
||||||
|
# Проверяем, существует ли актуальный файл cookies
|
||||||
|
if not os.path.exists(cookies_file):
|
||||||
|
print("ERROR: Cookies file is missing. Stopping execution.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
start_time = datetime.now()
|
start_time = datetime.now()
|
||||||
try:
|
try:
|
||||||
command = [
|
command = [
|
||||||
@ -44,7 +49,7 @@ def download_video(url):
|
|||||||
"--cache-dir", cache_dir,
|
"--cache-dir", cache_dir,
|
||||||
"--ffmpeg-location", ffmpeg_location,
|
"--ffmpeg-location", ffmpeg_location,
|
||||||
"--format", formats,
|
"--format", formats,
|
||||||
"--cookies", cookies_file,
|
"--cookies", cookies_file, # Используем всегда актуальный файл cookies
|
||||||
"--output", output_template,
|
"--output", output_template,
|
||||||
"--output", output_infojson,
|
"--output", output_infojson,
|
||||||
"--ignore-config",
|
"--ignore-config",
|
||||||
@ -62,7 +67,7 @@ def download_video(url):
|
|||||||
print(f"ERROR VIDEO {url}: {error_message}")
|
print(f"ERROR VIDEO {url}: {error_message}")
|
||||||
if "This video has been removed" in error_message or "Video unavailable" in error_message:
|
if "This video has been removed" in error_message or "Video unavailable" in error_message:
|
||||||
save_downloaded_url(failed_downloads_file, url)
|
save_downloaded_url(failed_downloads_file, url)
|
||||||
if "Sign in to confirm youre not a bot" in error_message:
|
if "Sign in to confirm you’re not a bot" in error_message:
|
||||||
print("Critical error detected: Sign-in required. Stopping execution.")
|
print("Critical error detected: Sign-in required. Stopping execution.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user