X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/f46044c66663049e286c20ee015db99d47d9dd8a..67afe88251ff8b1fcb43246c9a4bb1a0ea0185a2:/youtube_dl/extractor/pornhub.py?ds=sidebyside
diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py
index 3a27e37..daa284e 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,15 +60,19 @@ 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 \(', 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:
- password = compat_urllib_parse.unquote_plus(self._html_search_regex(r'"video_title":"([^"]+)', webpage, 'password'))
+ password = compat_urllib_parse.unquote_plus(
+ self._search_regex(r'"video_title":"([^"]+)', webpage, 'password'))
video_urls = list(map(lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'), video_urls))
formats = []