From 9665f15a960c4e274b0be5fbf22e6f4a6680d162 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 17 Sep 2022 11:34:04 +0530 Subject: [PATCH] [outtmpl] Make `%s` work in strfformat for all systems --- yt_dlp/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index a24ca828e..f6f7c38d1 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