X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fpornhub.py;h=0c8b731cf47267568e43ccd09ff21f1683b4d992;hb=509c630db8cdaff473f95805cda1ae350107e36b;hp=3a27e37890dc78b26af866c9884807c97c56ccb9;hpb=8fc642eb5b69f25d0488509c4c4f9d8bfe2b7225;p=youtube-dl diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 3a27e3789..0c8b731cf 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -33,10 +33,8 @@ class PornHubIE(InfoExtractor): } def _extract_count(self, pattern, webpage, name): - count = self._html_search_regex(pattern, webpage, '%s count' % name, fatal=False) - if count: - count = str_to_int(count) - return count + return str_to_int(self._search_regex( + pattern, webpage, '%s count' % name, fatal=False)) def _real_extract(self, url): video_id = self._match_id(url) @@ -62,11 +60,14 @@ class PornHubIE(InfoExtractor): if thumbnail: thumbnail = compat_urllib_parse.unquote(thumbnail) - view_count = self._extract_count(r'([\d,\.]+) views', webpage, 'view') - like_count = self._extract_count(r'([\d,\.]+)', webpage, 'like') - dislike_count = self._extract_count(r'([\d,\.]+)', webpage, 'dislike') + view_count = self._extract_count( + r'([\d,\.]+) views', webpage, 'view') + like_count = self._extract_count( + r'([\d,\.]+)', webpage, 'like') + dislike_count = self._extract_count( + r'([\d,\.]+)', webpage, 'dislike') comment_count = self._extract_count( - r'All comments \(([\d,\.]+)', webpage, 'comment') + r'All Comments\s*\(([\d,.]+)\)', webpage, 'comment') video_urls = list(map(compat_urllib_parse.unquote, re.findall(r'"quality_[0-9]{3}p":"([^"]+)', webpage))) if webpage.find('"encrypted":true') != -1: