aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-01-26 23:23:08 +0700
committerSergey M․ <dstftw@gmail.com>2017-01-26 23:23:08 +0700
commit15846398ca0af9154b88a69f594557568c6a4782 (patch)
tree21c8013fa156a013083d5774b0e342080c9acde4 /youtube_dl/utils.py
parentc19ef77c3138ecf1ce5c988de2d94031f58b4f69 (diff)
[utils] Improve parse_duration
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 98acc2b45..cf46711b9 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1773,7 +1773,7 @@ def parse_duration(s):
s = s.strip()
days, hours, mins, secs, ms = [None] * 5
- m = re.match(r'(?:(?:(?:(?P<days>[0-9]+):)?(?P<hours>[0-9]+):)?(?P<mins>[0-9]+):)?(?P<secs>[0-9]+)(?P<ms>\.[0-9]+)?$', s)
+ m = re.match(r'(?:(?:(?:(?P<days>[0-9]+):)?(?P<hours>[0-9]+):)?(?P<mins>[0-9]+):)?(?P<secs>[0-9]+)(?P<ms>\.[0-9]+)?Z?$', s)
if m:
days, hours, mins, secs, ms = m.groups()
else:
@@ -1790,11 +1790,11 @@ def parse_duration(s):
)?
(?:
(?P<secs>[0-9]+)(?P<ms>\.[0-9]+)?\s*s(?:ec(?:ond)?s?)?\s*
- )?$''', s)
+ )?Z?$''', s)
if m:
days, hours, mins, secs, ms = m.groups()
else:
- m = re.match(r'(?i)(?:(?P<hours>[0-9.]+)\s*(?:hours?)|(?P<mins>[0-9.]+)\s*(?:mins?\.?|minutes?)\s*)$', s)
+ m = re.match(r'(?i)(?:(?P<hours>[0-9.]+)\s*(?:hours?)|(?P<mins>[0-9.]+)\s*(?:mins?\.?|minutes?)\s*)Z?$', s)
if m:
hours, mins = m.groups()
else: