[extractor/joj] Fix extractor (#5934)

Authored by: OndrejBakan, pukkandan
This commit is contained in:
OndrejBakan 2023-01-03 06:35:05 +01:00 committed by GitHub
parent 990dd7b00f
commit 1a3cd8ec35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,9 +23,19 @@ class JojIE(InfoExtractor):
'id': 'a388ec4c-6019-4a4a-9312-b1bee194e932', 'id': 'a388ec4c-6019-4a4a-9312-b1bee194e932',
'ext': 'mp4', 'ext': 'mp4',
'title': 'NOVÉ BÝVANIE', 'title': 'NOVÉ BÝVANIE',
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*?$',
'duration': 3118, 'duration': 3118,
} }
}, {
'url': 'https://media.joj.sk/embed/CSM0Na0l0p1',
'info_dict': {
'id': 'CSM0Na0l0p1',
'ext': 'mp4',
'height': 576,
'title': 'Extrémne rodiny 2 - POKRAČOVANIE (2012/04/09 21:30:00)',
'duration': 3937,
'thumbnail': r're:^https?://.*?$',
}
}, { }, {
'url': 'https://media.joj.sk/embed/9i1cxv', 'url': 'https://media.joj.sk/embed/9i1cxv',
'only_matching': True, 'only_matching': True,
@ -43,10 +53,10 @@ def _real_extract(self, url):
webpage = self._download_webpage( webpage = self._download_webpage(
'https://media.joj.sk/embed/%s' % video_id, video_id) 'https://media.joj.sk/embed/%s' % video_id, video_id)
title = self._search_regex( title = (self._search_json(r'videoTitle\s*:', webpage, 'title', video_id,
(r'videoTitle\s*:\s*(["\'])(?P<title>(?:(?!\1).)+)\1', contains_pattern=r'["\'].+["\']', default=None)
r'<title>(?P<title>[^<]+)'), webpage, 'title', or self._html_extract_title(webpage, default=None)
default=None, group='title') or self._og_search_title(webpage) or self._og_search_title(webpage))
bitrates = self._parse_json( bitrates = self._parse_json(
self._search_regex( self._search_regex(
@ -58,11 +68,13 @@ def _real_extract(self, url):
for format_url in try_get(bitrates, lambda x: x['mp4'], list) or []: for format_url in try_get(bitrates, lambda x: x['mp4'], list) or []:
if isinstance(format_url, compat_str): if isinstance(format_url, compat_str):
height = self._search_regex( height = self._search_regex(
r'(\d+)[pP]\.', format_url, 'height', default=None) r'(\d+)[pP]|(pal)\.', format_url, 'height', default=None)
if height == 'pal':
height = 576
formats.append({ formats.append({
'url': format_url, 'url': format_url,
'format_id': format_field(height, None, '%sp'), 'format_id': format_field(height, None, '%sp'),
'height': int(height), 'height': int_or_none(height),
}) })
if not formats: if not formats:
playlist = self._download_xml( playlist = self._download_xml(