]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[xhamster] Fix author and like/dislike count extraction
authorfiocfun <fiocfun@gmail.com>
Sat, 27 May 2017 10:28:08 +0000 (13:28 +0300)
committerSergey M․ <dstftw@gmail.com>
Sun, 28 May 2017 00:55:07 +0000 (07:55 +0700)
youtube_dl/extractor/xhamster.py

index 7cf0629e7ea2838f5a918854fa39ba075935db1f..ae0c167c4863e5ddfeaabfb27d02a002a5aa6a30 100644 (file)
@@ -108,7 +108,7 @@ class XHamsterIE(InfoExtractor):
             webpage, 'upload date', fatal=False))
 
         uploader = self._html_search_regex(
-            r'<span[^>]+itemprop=["\']author[^>]+><a[^>]+href=["\'].+?xhamster\.com/user/[^>]+>(?P<uploader>.+?)</a>',
+            r'<span[^>]+?itemprop=["\']author[^>]+?><a[^>]+?href=["\'][^>]+?><span[^>]+?itemprop=["\']name[^>]+?>(.+?)</span',
             webpage, 'uploader', default='anonymous')
 
         thumbnail = self._search_regex(
@@ -124,7 +124,7 @@ class XHamsterIE(InfoExtractor):
             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)
+        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)
 
         mobj = re.search(r'</label>Comments \((?P<commentcount>\d+)\)</div>', webpage)