mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-05 08:40:04 +01:00
[YoutubeDL] Avoid negative timestamps on Windows
This commit is contained in:
parent
752c8c9b76
commit
706d7d4ee7
@ -787,6 +787,10 @@ def process_video_result(self, info_dict, download=True):
|
||||
info_dict['display_id'] = info_dict['id']
|
||||
|
||||
if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:
|
||||
# Working around negative timestamps in Windows
|
||||
# (see http://bugs.python.org/issue1646728)
|
||||
if info_dict['timestamp'] < 0 and os.name == 'nt':
|
||||
info_dict['timestamp'] = 0
|
||||
upload_date = datetime.datetime.utcfromtimestamp(
|
||||
info_dict['timestamp'])
|
||||
info_dict['upload_date'] = upload_date.strftime('%Y%m%d')
|
||||
|
Loading…
Reference in New Issue
Block a user