[drtuber] Extract counters
This commit is contained in:
		@@ -3,6 +3,7 @@ from __future__ import unicode_literals
 | 
				
			|||||||
import re
 | 
					import re
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .common import InfoExtractor
 | 
					from .common import InfoExtractor
 | 
				
			||||||
 | 
					from ..utils import str_to_int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DrTuberIE(InfoExtractor):
 | 
					class DrTuberIE(InfoExtractor):
 | 
				
			||||||
@@ -14,6 +15,9 @@ class DrTuberIE(InfoExtractor):
 | 
				
			|||||||
            'id': '1740434',
 | 
					            'id': '1740434',
 | 
				
			||||||
            'ext': 'mp4',
 | 
					            'ext': 'mp4',
 | 
				
			||||||
            'title': 'Hot Perky Blonde Naked Golf',
 | 
					            'title': 'Hot Perky Blonde Naked Golf',
 | 
				
			||||||
 | 
					            'like_count': int,
 | 
				
			||||||
 | 
					            'dislike_count': int,
 | 
				
			||||||
 | 
					            'comment_count': int,
 | 
				
			||||||
            'categories': list,  # NSFW
 | 
					            'categories': list,  # NSFW
 | 
				
			||||||
            'thumbnail': 're:https?://.*\.jpg$',
 | 
					            'thumbnail': 're:https?://.*\.jpg$',
 | 
				
			||||||
            'age_limit': 18,
 | 
					            'age_limit': 18,
 | 
				
			||||||
@@ -36,6 +40,16 @@ class DrTuberIE(InfoExtractor):
 | 
				
			|||||||
            r'poster="([^"]+)"',
 | 
					            r'poster="([^"]+)"',
 | 
				
			||||||
            webpage, 'thumbnail', fatal=False)
 | 
					            webpage, 'thumbnail', fatal=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        like_count = str_to_int(self._html_search_regex(
 | 
				
			||||||
 | 
					            r'<span id="rate_likes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>',
 | 
				
			||||||
 | 
					            webpage, 'like count', fatal=False))
 | 
				
			||||||
 | 
					        dislike_count = str_to_int(self._html_search_regex(
 | 
				
			||||||
 | 
					            r'<span id="rate_dislikes">\s*<img[^>]+>\s*<span>([\d,\.]+)</span>',
 | 
				
			||||||
 | 
					            webpage, 'like count', fatal=False))
 | 
				
			||||||
 | 
					        comment_count = str_to_int(self._html_search_regex(
 | 
				
			||||||
 | 
					            r'<span class="comments_count">([\d,\.]+)</span>',
 | 
				
			||||||
 | 
					            webpage, 'comment count', fatal=False))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cats_str = self._html_search_regex(
 | 
					        cats_str = self._html_search_regex(
 | 
				
			||||||
            r'<meta name="keywords" content="([^"]+)"', webpage, 'categories', fatal=False)
 | 
					            r'<meta name="keywords" content="([^"]+)"', webpage, 'categories', fatal=False)
 | 
				
			||||||
        categories = None if cats_str is None else cats_str.split(' ')
 | 
					        categories = None if cats_str is None else cats_str.split(' ')
 | 
				
			||||||
@@ -45,6 +59,9 @@ class DrTuberIE(InfoExtractor):
 | 
				
			|||||||
            'url': video_url,
 | 
					            'url': video_url,
 | 
				
			||||||
            'title': title,
 | 
					            'title': title,
 | 
				
			||||||
            'thumbnail': thumbnail,
 | 
					            'thumbnail': thumbnail,
 | 
				
			||||||
 | 
					            'like_count': like_count,
 | 
				
			||||||
 | 
					            'dislike_count': dislike_count,
 | 
				
			||||||
 | 
					            'comment_count': comment_count,
 | 
				
			||||||
            'categories': categories,
 | 
					            'categories': categories,
 | 
				
			||||||
            'age_limit': self._rta_search(webpage),
 | 
					            'age_limit': self._rta_search(webpage),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user