mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 02:45:12 +00:00
[utils] Improve parse_duration
Authored by: bashonly
This commit is contained in:
parent
75dc8e673b
commit
af86873218
2 changed files with 3 additions and 1 deletions
|
@ -655,6 +655,8 @@ def test_parse_duration(self):
|
|||
self.assertEqual(parse_duration('P0Y0M0DT0H4M20.880S'), 260.88)
|
||||
self.assertEqual(parse_duration('01:02:03:050'), 3723.05)
|
||||
self.assertEqual(parse_duration('103:050'), 103.05)
|
||||
self.assertEqual(parse_duration('1HR 3MIN'), 3780)
|
||||
self.assertEqual(parse_duration('2hrs 3mins'), 7380)
|
||||
|
||||
def test_fix_xml_ampersands(self):
|
||||
self.assertEqual(
|
||||
|
|
|
@ -2021,7 +2021,7 @@ def parse_duration(s):
|
|||
)?
|
||||
T)?
|
||||
(?:
|
||||
(?P<hours>[0-9]+)\s*h(?:ours?)?,?\s*
|
||||
(?P<hours>[0-9]+)\s*h(?:(?:ou)?rs?)?,?\s*
|
||||
)?
|
||||
(?:
|
||||
(?P<mins>[0-9]+)\s*m(?:in(?:ute)?s?)?,?\s*
|
||||
|
|
Loading…
Reference in a new issue