[xhamster] Fix view count extraction
authorSergey M․ <dstftw@gmail.com>
Fri, 8 Jan 2016 18:29:10 +0000 (00:29 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 8 Jan 2016 18:29:10 +0000 (00:29 +0600)
youtube_dl/extractor/xhamster.py

index 2b9ac2419a690385cee3ea50432d0cbf191d0d5e..ccee77359761b5214eb4ff24f8051f3dda1995eb 100644 (file)
@@ -89,9 +89,9 @@ class XHamsterIE(InfoExtractor):
             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:
-            view_count = str_to_int(view_count)
+        view_count = int_or_none(self._search_regex(
+            r'content=["\']User(?:View|Play)s:(\d+)',
+            webpage, 'view count', fatal=False))
 
         mobj = re.search(r"hint='(?P<likecount>\d+) Likes / (?P<dislikecount>\d+) Dislikes'", webpage)
         (like_count, dislike_count) = (mobj.group('likecount'), mobj.group('dislikecount')) if mobj else (None, None)