aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-08-05 11:41:55 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2016-08-05 11:41:55 +0800
commit7dc2a74e0ac9cfa74cc9de6f586ffd5cc8bac0d9 (patch)
treea296e66e2fa5cd3a352ffdcabb2018fbb4199e05 /youtube_dl/utils.py
parentb02b960c6bba834d9e7199ac53430c7933079dc8 (diff)
[utils] Fix unified_timestamp for formats parsed by parsedate_tz()
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index f5cd6819b..97ddd9883 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1101,7 +1101,7 @@ def unified_timestamp(date_str, day_first=True):
date_str = date_str.replace(',', ' ')
- pm_delta = datetime.timedelta(hours=12 if re.search(r'(?i)PM', date_str) else 0)
+ pm_delta = 12 if re.search(r'(?i)PM', date_str) else 0
timezone, date_str = extract_timezone(date_str)
# Remove AM/PM + timezone
@@ -1109,13 +1109,13 @@ def unified_timestamp(date_str, day_first=True):
for expression in date_formats(day_first):
try:
- dt = datetime.datetime.strptime(date_str, expression) - timezone + pm_delta
+ dt = datetime.datetime.strptime(date_str, expression) - timezone + datetime.timedelta(hours=pm_delta)
return calendar.timegm(dt.timetuple())
except ValueError:
pass
timetuple = email.utils.parsedate_tz(date_str)
if timetuple:
- return calendar.timegm(timetuple.timetuple())
+ return calendar.timegm(timetuple) + pm_delta * 3600
def determine_ext(url, default_ext='unknown_video'):