]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/joj.py
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?
://.*\
.jpg$
',
30 'url
': 'https
://media
.joj
.sk
/embed
/9i1cxv
',
31 'only_matching
': True,
33 'url
': 'joj
:a388ec4c
-6019-4a4a
-9312-b1bee194e932
',
34 'only_matching
': True,
37 'only_matching
': True,
40 def _real_extract(self, url):
41 video_id = self._match_id(url)
43 webpage = self._download_webpage(
44 'https
://media
.joj
.sk
/embed
/%s' % video_id, video_id)
46 title = self._search_regex(
47 (r'videoTitle\s
*:\s
*(["\'])(?P<title>(?:(?!\1).)+)\1',
48 r'<title>(?P<title>[^<]+)'), webpage, 'title',
49 default=None, group='title') or self._og_search_title(webpage)
51 bitrates = self._parse_json(
53 r'(?s)(?:src|bitrates)\s*=\s*({.+?});', webpage, 'bitrates',
55 video_id, transform_source=js_to_json, fatal=False)
58 for format_url in try_get(bitrates, lambda x: x['mp4'], list) or []:
59 if isinstance(format_url, compat_str):
60 height = self._search_regex(
61 r'(\d+)[pP]\.', format_url, 'height', default=None)
64 'format_id': format_field(height, None, '%sp'),
65 'height': int(height),
68 playlist = self._download_xml(
69 'https://media.joj.sk/services/Video.php?clip=%s' % video_id,
71 for file_el in playlist.findall('./files/file'):
72 path = file_el.get('path')
75 format_id = file_el.get('id') or file_el.get('label')
77 'url': 'http://n16.joj.sk/storage/%s' % path.replace(
79 'format_id': format_id,
80 'height': int_or_none(self._search_regex(
81 r'(\d+)[pP]', format_id or path, 'height',
84 self._sort_formats(formats)
86 thumbnail = self._og_search_thumbnail(webpage)
88 duration = int_or_none(self._search_regex(
89 r'videoDuration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
94 'thumbnail': thumbnail,