1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-07 18:15:15 +00:00

Warn when yt-dlp is severely outdated (#13937)

Authored by: seproDev
This commit is contained in:
sepro
2025-08-06 21:14:45 +02:00
committed by GitHub
parent 8175f3738f
commit 662af5bb83
5 changed files with 27 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import atexit
import contextlib
import datetime as dt
import functools
import hashlib
import json
@@ -171,6 +172,22 @@ def _get_system_deprecation():
return f'Support for Python version {major}.{minor} has been deprecated. {PYTHON_MSG}'
def _get_outdated_warning():
# Only yt-dlp guarantees a stable release at least every 90 days
if not ORIGIN.startswith('yt-dlp/'):
return None
with contextlib.suppress(Exception):
last_updated = dt.date(*version_tuple(__version__)[:3])
if last_updated < dt.datetime.now(dt.timezone.utc).date() - dt.timedelta(days=90):
return ('\n '.join((
f'Your yt-dlp version ({__version__}) is older than 90 days!',
'It is strongly recommended to always use the latest version.',
f'{is_non_updateable() or """Run "yt-dlp --update" or "yt-dlp -U" to update"""}.',
'To suppress this warning, add --no-update to your command/config.')))
return None
def _sha256_file(path):
h = hashlib.sha256()
mv = memoryview(bytearray(128 * 1024))