1 from .common
import InfoExtractor
10 class JojIE(InfoExtractor
):
14 https?://media\.joj\.sk/embed/
18 _EMBED_REGEX
= [r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>(?
:https?
:)?
//media\
.joj\
.sk
/embed
/(?
:(?
!\
1).)+)\
1']
20 'url
': 'https
://media
.joj
.sk
/embed
/a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
22 'id': 'a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
24 'title
': 'NOVÉ BÝVANIE
',
25 'thumbnail
': r're
:^https?
://.*?$
',
29 'url
': 'https
://media
.joj
.sk
/embed
/CSM0Na0l0p1
',
34 'title
': 'Extrémne rodiny
2 - POKRAČ
OVANIE (2012/04/09 21:30:00)',
36 'thumbnail
': r're
:^https?
://.*?$
',
39 'url
': 'https
://media
.joj
.sk
/embed
/9i1cxv
',
40 'only_matching
': True,
42 'url
': 'joj
:a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
43 'only_matching
': True,
46 'only_matching
': True,
49 def _real_extract(self, url):
50 video_id = self._match_id(url)
52 webpage = self._download_webpage(
53 f'https
://media
.joj
.sk
/embed
/{video_id}
', video_id)
55 title = (self._search_json(r'videoTitle\s
*:', webpage, 'title
', video_id,
56 contains_pattern=r'["\'].+["\']', default=None)
57 or self._html_extract_title(webpage, default=None)
58 or self._og_search_title(webpage))
60 bitrates = self._parse_json(
62 r'(?s
)(?
:src|bitrates
)\s
*=\s
*({.+?
});', webpage, 'bitrates
',
64 video_id, transform_source=js_to_json, fatal=False)
67 for format_url in try_get(bitrates, lambda x: x['mp4
'], list) or []:
68 if isinstance(format_url, str):
69 height = self._search_regex(
70 r'(\d
+)[pP
]|
(pal
)\
.', format_url, 'height
', default=None)
75 'format_id
': format_field(height, None, '%sp
'),
76 'height
': int_or_none(height),
79 playlist = self._download_xml(
80 f'https
://media
.joj
.sk
/services
/Video
.php?clip
={video_id}
',
82 for file_el in playlist.findall('./files
/file'):
83 path = file_el.get('path
')
86 format_id = file_el.get('id') or file_el.get('label
')
88 'url
': 'http
://n16
.joj
.sk
/storage
/{}'.format(path.replace(
90 'format_id
': format_id,
91 'height
': int_or_none(self._search_regex(
92 r'(\d
+)[pP
]', format_id or path, 'height
',
96 thumbnail = self._og_search_thumbnail(webpage)
98 duration = int_or_none(self._search_regex(
99 r'videoDuration\s
*:\s
*(\d
+)', webpage, 'duration
', fatal=False))
104 'thumbnail
': thumbnail,
105 'duration
': duration,