1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 01:08:10 +00:00

[YoutubeDL] Handle out-of-range timestamps (#5826)

This commit is contained in:
Sergey M․ 2015-06-08 21:05:17 +06:00
parent 01e21b89ee
commit a55e36f48d

View file

@ -1016,13 +1016,13 @@ class YoutubeDL(object):
info_dict['display_id'] = info_dict['id'] info_dict['display_id'] = info_dict['id']
if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None: if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:
# Working around negative timestamps in Windows # Working around out-of-range timestamp values (e.g. negative ones on Windows,
# (see http://bugs.python.org/issue1646728) # see http://bugs.python.org/issue1646728)
if info_dict['timestamp'] < 0 and os.name == 'nt': try:
info_dict['timestamp'] = 0 upload_date = datetime.datetime.utcfromtimestamp(info_dict['timestamp'])
upload_date = datetime.datetime.utcfromtimestamp(
info_dict['timestamp'])
info_dict['upload_date'] = upload_date.strftime('%Y%m%d') info_dict['upload_date'] = upload_date.strftime('%Y%m%d')
except (ValueError, OverflowError, OSError):
pass
if self.params.get('listsubtitles', False): if self.params.get('listsubtitles', False):
if 'automatic_captions' in info_dict: if 'automatic_captions' in info_dict: