]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/joj.py
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
13 class JojIE(InfoExtractor
):
17 https?://media\.joj\.sk/embed/
22 'url': 'https://media.joj.sk/embed/a388ec4c-6019-4a4a-9312-b1bee194e932',
24 'id': 'a388ec4c-6019-4a4a-9312-b1bee194e932',
26 'title': 'NOVÉ BÝVANIE',
27 'thumbnail': r
're:^https?://.*\.jpg$',
31 'url': 'https://media.joj.sk/embed/9i1cxv',
32 'only_matching': True,
34 'url': 'joj:a388ec4c-6019-4a4a-9312-b1bee194e932',
35 'only_matching': True,
38 'only_matching': True,
42 def _extract_urls(webpage
):
45 for mobj
in re
.finditer(
46 r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>(?
:https?
:)?
//media\
.joj\
.sk
/embed
/(?
:(?
!\
1).)+)\
1',
49 def _real_extract(self, url):
50 video_id = self._match_id(url)
52 webpage = self._download_webpage(
53 'https
://media
.joj
.sk
/embed
/%s' % video_id, video_id)
55 title = self._search_regex(
56 (r'videoTitle\s
*:\s
*(["\'])(?P<title>(?:(?!\1).)+)\1',
57 r'<title>(?P<title>[^<]+)'), webpage, 'title',
58 default=None, group='title') 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, compat_str):
69 height = self._search_regex(
70 r'(\d+)[pP]\.', format_url, 'height', default=None)
73 'format_id': format_field(height, template='%sp'),
74 'height': int(height),
77 playlist = self._download_xml(
78 'https://media.joj.sk/services/Video.php?clip=%s' % video_id,
80 for file_el in playlist.findall('./files/file'):
81 path = file_el.get('path')
84 format_id = file_el.get('id') or file_el.get('label')
86 'url': 'http://n16.joj.sk/storage/%s' % path.replace(
88 'format_id': format_id,
89 'height': int_or_none(self._search_regex(
90 r'(\d+)[pP]', format_id or path, 'height',
93 self._sort_formats(formats)
95 thumbnail = self._og_search_thumbnail(webpage)
97 duration = int_or_none(self._search_regex(
98 r'videoDuration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
103 'thumbnail': thumbnail,
104 'duration': duration,