From 34e1010545c5aba424cb77cf0b4cbfc0f3830408 Mon Sep 17 00:00:00 2001 From: DarkFighterLuke Date: Thu, 10 Mar 2022 15:07:24 +0100 Subject: [PATCH] Fix view_count --- youtube_dl/extractor/pornhub.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index e2e1500ff..3f5ee40cd 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -20,8 +20,8 @@ from ..utils import ( merge_dicts, NO_DEFAULT, orderedSet, + parse_count, remove_quotes, - str_to_int, update_url_query, urlencode_postdata, url_or_none, @@ -132,7 +132,7 @@ class PornHubIE(PornHubBaseIE): ''' % PornHubBaseIE._PORNHUB_HOST_RE _TESTS = [{ 'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015', - 'md5': 'a6391306d050e4547f62b3f485dd9ba9', + 'md5': 'fc5caada049bee2e944229ad850ef5db', 'info_dict': { 'id': '648719015', 'ext': 'mp4', @@ -255,7 +255,7 @@ class PornHubIE(PornHubBaseIE): webpage) def _extract_count(self, pattern, webpage, name): - return str_to_int(self._search_regex( + return parse_count(self._search_regex( pattern, webpage, '%s count' % name, fatal=False)) def _real_extract(self, url): @@ -466,7 +466,7 @@ class PornHubIE(PornHubBaseIE): webpage, name) view_count = self._extract_count( - r'([\d,\.]+) [Vv]iews', webpage, 'view') + r'(?P.+?) [Vv]iews', webpage, 'view') like_count = extract_vote_count('Up', 'like') dislike_count = extract_vote_count('Down', 'dislike') comment_count = self._extract_count(