This commit is contained in:
scrat5h 2024-05-12 08:52:21 +05:30 committed by GitHub
commit 61a1d05a02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 4 deletions

View File

@ -12,6 +12,7 @@ from ..networking.exceptions import HTTPError
from ..utils import ( from ..utils import (
NO_DEFAULT, NO_DEFAULT,
ExtractorError, ExtractorError,
base_url,
clean_html, clean_html,
determine_ext, determine_ext,
format_field, format_field,
@ -24,6 +25,7 @@ from ..utils import (
update_url_query, update_url_query,
url_or_none, url_or_none,
urlencode_postdata, urlencode_postdata,
urljoin,
) )
@ -138,12 +140,14 @@ class PornHubIE(PornHubBaseIE):
_EMBED_REGEX = [r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub(?:premium)?\.(?:com|net|org)/embed/[\da-z]+)'] _EMBED_REGEX = [r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub(?:premium)?\.(?:com|net|org)/embed/[\da-z]+)']
_TESTS = [{ _TESTS = [{
'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015', 'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
'md5': 'a6391306d050e4547f62b3f485dd9ba9', 'md5': '4d4a4e9178b655776f86cf89ecaf0edf',
'info_dict': { 'info_dict': {
'id': '648719015', 'id': '648719015',
'ext': 'mp4', 'ext': 'mp4',
'thumbnail': r're:^https://.i\.phncdn\.com/videos/201306/28/14084201/original/.*\.jpg',
'title': 'Seductive Indian beauty strips down and fingers her pink pussy', 'title': 'Seductive Indian beauty strips down and fingers her pink pussy',
'uploader': 'Babes', 'uploader': 'BABES-COM',
'uploader_id': '/users/babes-com',
'upload_date': '20130628', 'upload_date': '20130628',
'timestamp': 1372447216, 'timestamp': 1372447216,
'duration': 361, 'duration': 361,
@ -208,11 +212,22 @@ class PornHubIE(PornHubBaseIE):
'url': 'http://www.pornhub.com/view_video.php?viewkey=ph601dc30bae19a', 'url': 'http://www.pornhub.com/view_video.php?viewkey=ph601dc30bae19a',
'info_dict': { 'info_dict': {
'id': 'ph601dc30bae19a', 'id': 'ph601dc30bae19a',
'ext': 'mp4',
'uploader': 'Projekt Melody', 'uploader': 'Projekt Melody',
'uploader_id': 'projekt-melody', 'uploader_id': 'projekt-melody',
'upload_date': '20210205', 'upload_date': '20210205',
'title': '"Welcome to My Pussy Mansion" - CB Stream (02/03/21)', 'title': '"Welcome to My Pussy Mansion" - CB Stream (02/03/21)',
'thumbnail': r're:https?://.+', 'thumbnail': r're:https?://.+',
'age_limit': 18,
'view_count': int,
'cast': [],
'like_count': int,
'comment_count': int,
'dislike_count': int,
'timestamp': 1612564932,
'duration': 8173,
'categories': list,
'tags': list,
}, },
}, { }, {
'url': 'http://www.pornhub.com/view_video.php?viewkey=ph557bbb6676d2d', 'url': 'http://www.pornhub.com/view_video.php?viewkey=ph557bbb6676d2d',
@ -318,10 +333,10 @@ class PornHubIE(PornHubBaseIE):
r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'), r'var\s+flashvars_\d+\s*=\s*({.+?});', webpage, 'flashvars', default='{}'),
video_id) video_id)
if flashvars: if flashvars:
subtitle_url = url_or_none(flashvars.get('closedCaptionsFile')) subtitle_url = flashvars.get('closedCaptionsFile')
if subtitle_url: if subtitle_url:
subtitles.setdefault('en', []).append({ subtitles.setdefault('en', []).append({
'url': subtitle_url, 'url': urljoin(base_url(url), subtitle_url),
'ext': 'srt', 'ext': 'srt',
}) })
thumbnail = flashvars.get('image_url') thumbnail = flashvars.get('image_url')