diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-10-29 07:04:48 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2017-10-29 07:04:48 +0700 |
commit | 056653bbb1b94ba04f331ed4c27a1c0d24fe1e30 (patch) | |
tree | 142b8eddeacc00b056040155b923d8db2d7fd0a7 /youtube_dl/utils.py | |
parent | c3206d02e94ce98c6467762a228a9e58616c6d8f (diff) |
[utils] Add support for zero years and months in parse_duration
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 59fb33435..34866a54b 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1835,10 +1835,20 @@ def parse_duration(s): days, hours, mins, secs, ms = m.groups() else: m = re.match( - r'''(?ix)(?:P?T)? + r'''(?ix)(?:P? + (?: + [0-9]+\s*y(?:ears?)?\s* + )? + (?: + [0-9]+\s*m(?:onths?)?\s* + )? + (?: + [0-9]+\s*w(?:eeks?)?\s* + )? (?: (?P<days>[0-9]+)\s*d(?:ays?)?\s* )? + T)? (?: (?P<hours>[0-9]+)\s*h(?:ours?)?\s* )? |