diff options
author | Sergey M․ <dstftw@gmail.com> | 2014-08-31 06:44:14 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2014-08-31 06:44:14 +0700 |
commit | 6a400a6339911333517bfa59f5f7c2a05d948f19 (patch) | |
tree | ce3b993bb50b34b0211975bc9812bcf08b4b0dce /youtube_dl/utils.py | |
parent | 08a36c35693d212405a50b490f7f1828830e60ee (diff) | |
parent | 7b53af7f70da81eae41da645cc5af2c777c5c8e5 (diff) |
Merge branch 'peugeot-vporn'
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 4f0210872..e07750434 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1332,8 +1332,10 @@ def parse_duration(s): if s is None: return None + s = s.strip() + m = re.match( - r'(?:(?:(?P<hours>[0-9]+)[:h])?(?P<mins>[0-9]+)[:m])?(?P<secs>[0-9]+)s?(?::[0-9]+)?(?P<ms>\.[0-9]+)?$', s) + r'(?:(?:(?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')) |