mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 16:42:57 +01:00
[utils] Improve parse_duration
Authored by: bashonly
This commit is contained in:
parent
75dc8e673b
commit
af86873218
@ -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 New Issue
Block a user