diff --git a/test/test_utils.py b/test/test_utils.py index 04f1bf283..badab1370 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -220,6 +220,9 @@ class TestUtil(unittest.TestCase): self.assertEqual(parse_duration('0s'), 0) self.assertEqual(parse_duration('01:02:03.05'), 3723.05) self.assertEqual(parse_duration('T30M38S'), 1838) + self.assertEqual(parse_duration('5 s'), 5) + self.assertEqual(parse_duration('3 min'), 180) + self.assertEqual(parse_duration('2.5 hours'), 9000) def test_fix_xml_ampersands(self): self.assertEqual( diff --git a/youtube_dl/extractor/minhateca.py b/youtube_dl/extractor/minhateca.py index 077c9b19d..14934b7ec 100644 --- a/youtube_dl/extractor/minhateca.py +++ b/youtube_dl/extractor/minhateca.py @@ -8,6 +8,7 @@ from ..compat import ( ) from ..utils import ( int_or_none, + parse_duration, parse_filesize, ) @@ -52,8 +53,8 @@ class MinhatecaIE(InfoExtractor): filesize_approx = parse_filesize(self._html_search_regex( r'
(.*?)
', webpage, 'file size approximation', fatal=False)) - duration = int_or_none(self._html_search_regex( - r'(?s).*?([0-9]+)\s*s', + duration = parse_duration(self._html_search_regex( + r'(?s)
.*?class="bold">(.*?)<', webpage, 'duration', fatal=False)) view_count = int_or_none(self._html_search_regex( r'
([0-9]+)
', diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 5e9ae7a42..5efb4c59a 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1206,18 +1206,29 @@ def parse_duration(s): m = re.match( r'''(?ix)T? + (?: + (?P