1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class JojIE(InfoExtractor
):
15 https?://media\.joj\.sk/embed/
19 _EMBED_REGEX
= [r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>(?
:https?
:)?
//media\
.joj\
.sk
/embed
/(?
:(?
!\
1).)+)\
1']
21 'url
': 'https
://media
.joj
.sk
/embed
/a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
23 'id': 'a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
25 'title
': 'NOVÉ BÝVANIE
',
26 'thumbnail
': r're
:^https?
://.*?$
',
30 'url
': 'https
://media
.joj
.sk
/embed
/CSM0Na0l0p1
',
35 'title
': 'Extrémne rodiny
2 - POKRAČ
OVANIE (2012/04/09 21:30:00)',
37 'thumbnail
': r're
:^https?
://.*?$
',
40 'url
': 'https
://media
.joj
.sk
/embed
/9i1cxv
',
41 'only_matching
': True,
43 'url
': 'joj
:a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
44 'only_matching
': True,
47 'only_matching
': True,
50 def _real_extract(self, url):
51 video_id = self._match_id(url)
53 webpage = self._download_webpage(
54 'https
://media
.joj
.sk
/embed
/%s' % video_id, video_id)
56 title = (self._search_json(r'videoTitle\s
*:', webpage, 'title
', video_id,
57 contains_pattern=r'["\'].+["\']', default=None)
58 or self._html_extract_title(webpage, default=None)
59 or self._og_search_title(webpage))
61 bitrates = self._parse_json(
63 r'(?s
)(?
:src|bitrates
)\s
*=\s
*({.+?
});', webpage, 'bitrates
',
65 video_id, transform_source=js_to_json, fatal=False)
68 for format_url in try_get(bitrates, lambda x: x['mp4
'], list) or []:
69 if isinstance(format_url, compat_str):
70 height = self._search_regex(
71 r'(\d
+)[pP
]|
(pal
)\
.', format_url, 'height
', default=None)
76 'format_id
': format_field(height, None, '%sp
'),
77 'height
': int_or_none(height),
80 playlist = self._download_xml(
81 'https
://media
.joj
.sk
/services
/Video
.php?clip
=%s' % video_id,
83 for file_el in playlist.findall('./files
/file'):
84 path = file_el.get('path
')
87 format_id = file_el.get('id') or file_el.get('label
')
89 'url
': 'http
://n16
.joj
.sk
/storage
/%s' % path.replace(
91 'format_id
': format_id,
92 'height
': int_or_none(self._search_regex(
93 r'(\d
+)[pP
]', format_id or path, 'height
',
97 thumbnail = self._og_search_thumbnail(webpage)
99 duration = int_or_none(self._search_regex(
100 r'videoDuration\s
*:\s
*(\d
+)', webpage, 'duration
', fatal=False))
105 'thumbnail
': thumbnail,
106 'duration
': duration,