From 61149c3b4870ee7db038cb69f8f1cec9c7a14cc1 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Mon, 21 Sep 2026 15:11:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B8=D0=B4=D0=B5=D0=BE=20=D0=BE=D1=82?= =?UTF-8?q?=20=D0=BD=D0=B5=D1=83=D0=B4=D0=B0=D1=87=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=20=D1=82=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=20=D0=B8=D1=81=D1=82=D0=B5=D0=BA=D0=B0=D1=8E=D1=82?= =?UTF-8?q?=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=2030=20=D0=BC=D0=B8=D0=BD?= =?UTF-8?q?=D1=83=D1=82=20(=D0=BF=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index d6f402c..c6e22e4 100644 --- a/app.py +++ b/app.py @@ -469,6 +469,12 @@ def download_video(video_id): if not matches: return "Видео не найдено", 404 video_path = matches[0] + # Если результата в БД нет (неудачный анализ) — проверяем время создания файла. + if result is None: + mtime = datetime.fromtimestamp(os.path.getmtime(video_path)) + if datetime.now() - mtime > storage.RESULT_TTL: + return "Ссылка устарела. Видео доступно в течение 30 минут.", 410 + video_path = matches[0] ext = os.path.splitext(video_path)[1].lower() mime = VIDEO_MIME.get(ext, "application/octet-stream") return send_file(