[extractor/pornez] Support new URL formats (#6792)

Closes #6791, Closes #6298
Authored by: zhgwn
This commit is contained in:
zhgwn 2023-04-18 04:18:29 +02:00 committed by GitHub
parent 2c566ed141
commit cbdf9408e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,42 +1,60 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import int_or_none, urljoin from ..utils import (
clean_html,
int_or_none,
get_element_by_class,
urljoin,
)
class PornezIE(InfoExtractor): class PornezIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?pornez\.net/video(?P<id>[0-9]+)/' _VALID_URL = r'https?://(?:www\.)?pornez\.net/(?:video(?P<id>\w+)|watch)/'
_TEST = { _TESTS = [{
'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/', 'url': 'https://pornez.net/video344819/mistresst-funny_penis_names-wmv/',
'md5': '2e19a0a1cff3a5dbea0ef1b9e80bcbbc',
'info_dict': { 'info_dict': {
'id': '344819', 'id': '344819',
'ext': 'mp4', 'ext': 'mp4',
'title': r'mistresst funny_penis_names wmv', 'title': 'mistresst funny_penis_names wmv',
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*\.jpg$',
'age_limit': 18, 'age_limit': 18,
} },
} 'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://pornez.net/watch/leana+lovings+stiff+for+stepdaughter/',
'info_dict': {
'id': '156161',
'ext': 'mp4',
'title': 'Watch leana lovings stiff for stepdaughter porn video.',
'age_limit': 18,
},
'params': {'skip_download': 'm3u8'},
}, {
'url': 'https://pornez.net/videovzs27fj/tutor4k-e14-blue-wave-1080p-nbq-tutor4k-e14-blue-wave/',
'only_matching': True,
}]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
iframe_src = self._html_search_regex( if not video_id:
r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe', fatal=True) video_id = self._search_regex(
iframe_src = urljoin('https://pornez.net', iframe_src) r'<link[^>]+\bhref=["\']https?://pornez.net/\?p=(\w+)["\']', webpage, 'id')
title = self._html_search_meta(['name', 'twitter:title', 'og:title'], webpage, 'title', default=None)
if title is None: iframe_src = self._html_search_regex(r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe')
title = self._search_regex(r'<h1>(.*?)</h1>', webpage, 'title', fatal=True) iframe = self._download_webpage(urljoin('https://pornez.net', iframe_src), video_id)
thumbnail = self._html_search_meta(['thumbnailUrl'], webpage, 'title', default=None)
webpage = self._download_webpage(iframe_src, video_id) entries = self._parse_html5_media_entries(iframe_src, iframe, video_id)[0]
entries = self._parse_html5_media_entries(iframe_src, webpage, video_id)[0] for fmt in entries['formats']:
for format in entries['formats']: height = self._search_regex(r'_(\d+)\.m3u8', fmt['url'], 'height')
height = self._search_regex(r'_(\d+)\.m3u8', format['url'], 'height') fmt['format_id'] = '%sp' % height
format['format_id'] = '%sp' % height fmt['height'] = int_or_none(height)
format['height'] = int_or_none(height)
entries.update({ entries.update({
'id': video_id, 'id': video_id,
'title': title, 'title': (clean_html(get_element_by_class('video-title', webpage))
'thumbnail': thumbnail, or self._html_search_meta(
'age_limit': 18 ['twitter:title', 'og:title', 'description'], webpage, 'title', default=None)),
'thumbnail': self._html_search_meta(['thumbnailUrl'], webpage, 'thumb', default=None),
'age_limit': 18,
}) })
return entries return entries