diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-01-09 00:26:37 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-01-09 00:26:37 +0600 |
commit | 44731e308cdcc89fda1e613e094aa23de33f5c9e (patch) | |
tree | fe8e959508080d05f96eb1980c8f20ad684a0930 | |
parent | 4763b624a6655bc2333157031c73858f6b918f61 (diff) |
[xhamster] Fix duration extraction
-rw-r--r-- | youtube_dl/extractor/xhamster.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py index 560c38e26..2b9ac2419 100644 --- a/youtube_dl/extractor/xhamster.py +++ b/youtube_dl/extractor/xhamster.py @@ -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: |