aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-11-16 14:55:22 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-11-16 14:55:22 +0100
commit6a68bb574acaf4df3f3f01d3330498cad5101773 (patch)
tree70f89403f1134548ec187dbce123a781aff3e2c3 /youtube_dl/utils.py
parent0cf166ad4fe7e26dcb2d07feb2339da3276fa81f (diff)
[eporner] Fix duration (Closes #4188)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 67be4a9ae..58897231d 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1115,7 +1115,12 @@ def parse_duration(s):
s = s.strip()
m = re.match(
- r'(?i)(?:(?:(?P<hours>[0-9]+)\s*(?:[:h]|hours?)\s*)?(?P<mins>[0-9]+)\s*(?:[:m]|mins?|minutes?)\s*)?(?P<secs>[0-9]+)(?P<ms>\.[0-9]+)?\s*(?:s|secs?|seconds?)?$', s)
+ r'''(?ix)T?
+ (?:
+ (?:(?P<hours>[0-9]+)\s*(?:[:h]|hours?)\s*)?
+ (?P<mins>[0-9]+)\s*(?:[:m]|mins?|minutes?)\s*
+ )?
+ (?P<secs>[0-9]+)(?P<ms>\.[0-9]+)?\s*(?:s|secs?|seconds?)?$''', s)
if not m:
return None
res = int(m.group('secs'))