]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[xhamster] Fix duration extraction
authorSergey M․ <dstftw@gmail.com>
Fri, 8 Jan 2016 18:26:37 +0000 (00:26 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 8 Jan 2016 18:26:37 +0000 (00:26 +0600)
youtube_dl/extractor/xhamster.py

index 560c38e269c7f7eed8ed01f8ac2e66d032f68240..2b9ac2419a690385cee3ea50432d0cbf191d0d5e 100644 (file)
@@ -4,10 +4,10 @@ import re
 
 from .common import InfoExtractor
 from ..utils import (
-    unified_strdate,
-    str_to_int,
+    float_or_none,
     int_or_none,
-    parse_duration,
+    str_to_int,
+    unified_strdate,
 )
 
 
@@ -85,8 +85,9 @@ class XHamsterIE(InfoExtractor):
              r'''<video[^>]+poster=(?P<q>["'])(?P<thumbnail>.+?)(?P=q)[^>]*>'''],
             webpage, 'thumbnail', fatal=False, group='thumbnail')
 
-        duration = parse_duration(self._html_search_regex(r'<span>Runtime:</span> (\d+:\d+)</div>',
-                                                          webpage, 'duration', fatal=False))
+        duration = float_or_none(self._search_regex(
+            r'(["\'])duration\1\s*:\s*(["\'])(?P<duration>.+?)\2',
+            webpage, 'duration', fatal=False, group='duration'))
 
         view_count = self._html_search_regex(r'<span>Views:</span> ([^<]+)</div>', webpage, 'view count', fatal=False)
         if view_count: