Skip to content

Commit

Permalink
[YoutubeDL] Avoid negative timestamps on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Dec 2, 2014
1 parent 752c8c9 commit 706d7d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions youtube_dl/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 706d7d4

Please sign in to comment.