[xhamster] Fix duration extraction

This commit is contained in:
Sergey M․ 2016-01-09 00:26:37 +06:00
parent 4763b624a6
commit 44731e308c

View file

@ -4,10 +4,10 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
unified_strdate, float_or_none,
str_to_int,
int_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)[^>]*>'''], r'''<video[^>]+poster=(?P<q>["'])(?P<thumbnail>.+?)(?P=q)[^>]*>'''],
webpage, 'thumbnail', fatal=False, group='thumbnail') webpage, 'thumbnail', fatal=False, group='thumbnail')
duration = parse_duration(self._html_search_regex(r'<span>Runtime:</span> (\d+:\d+)</div>', duration = float_or_none(self._search_regex(
webpage, 'duration', fatal=False)) 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) view_count = self._html_search_regex(r'<span>Views:</span> ([^<]+)</div>', webpage, 'view count', fatal=False)
if view_count: if view_count: