diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index a24ca828e0..f6f7c38d10 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -2567,6 +2567,8 @@ def strftime_or_none(timestamp, date_format, default=None): datetime_object = datetime.datetime.utcfromtimestamp(timestamp) elif isinstance(timestamp, str): # assume YYYYMMDD datetime_object = datetime.datetime.strptime(timestamp, '%Y%m%d') + date_format = re.sub( # Support %s on windows + r'(?{int(datetime_object.timestamp())}', date_format) return datetime_object.strftime(date_format) except (ValueError, TypeError, AttributeError): return default