mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-11 20:51:01 +01:00
[pornhub] Improve like and dislike count extraction (closes #27356)
This commit is contained in:
parent
17e0f41d34
commit
4f1dc1463d
|
@ -361,12 +361,16 @@ class PornHubIE(PornHubBaseIE):
|
||||||
r'(?s)From: .+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<',
|
r'(?s)From: .+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<',
|
||||||
webpage, 'uploader', default=None)
|
webpage, 'uploader', default=None)
|
||||||
|
|
||||||
|
def extract_vote_count(kind, name):
|
||||||
|
return self._extract_count(
|
||||||
|
(r'<span[^>]+\bclass="votes%s"[^>]*>([\d,\.]+)</span>' % kind,
|
||||||
|
r'<span[^>]+\bclass=["\']votes%s["\'][^>]*\bdata-rating=["\'](\d+)' % kind),
|
||||||
|
webpage, name)
|
||||||
|
|
||||||
view_count = self._extract_count(
|
view_count = self._extract_count(
|
||||||
r'<span class="count">([\d,\.]+)</span> [Vv]iews', webpage, 'view')
|
r'<span class="count">([\d,\.]+)</span> [Vv]iews', webpage, 'view')
|
||||||
like_count = self._extract_count(
|
like_count = extract_vote_count('Up', 'like')
|
||||||
r'<span[^>]+class="votesUp"[^>]*>([\d,\.]+)</span>', webpage, 'like')
|
dislike_count = extract_vote_count('Down', 'dislike')
|
||||||
dislike_count = self._extract_count(
|
|
||||||
r'<span[^>]+class="votesDown"[^>]*>([\d,\.]+)</span>', webpage, 'dislike')
|
|
||||||
comment_count = self._extract_count(
|
comment_count = self._extract_count(
|
||||||
r'All Comments\s*<span>\(([\d,.]+)\)', webpage, 'comment')
|
r'All Comments\s*<span>\(([\d,.]+)\)', webpage, 'comment')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user