]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/joj.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
16 class JojIE(InfoExtractor
):
20 https?://media\.joj\.sk/embed/
25 'url': 'https://media.joj.sk/embed/a388ec4c-6019-4a4a-9312-b1bee194e932',
27 'id': 'a388ec4c-6019-4a4a-9312-b1bee194e932',
29 'title': 'NOVÉ BÝVANIE',
30 'thumbnail': r
're:^https?://.*\.jpg$',
34 'url': 'https://media.joj.sk/embed/9i1cxv',
35 'only_matching': True,
37 'url': 'joj:a388ec4c-6019-4a4a-9312-b1bee194e932',
38 'only_matching': True,
41 'only_matching': True,
45 def _extract_urls(webpage
):
48 for mobj
in re
.finditer(
49 r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>(?
:https?
:)?
//media\
.joj\
.sk
/embed
/(?
:(?
!\
1).)+)\
1',
52 def _real_extract(self, url):
53 video_id = self._match_id(url)
55 webpage = self._download_webpage(
56 'https
://media
.joj
.sk
/embed
/%s' % video_id, video_id)
58 title = self._search_regex(
59 (r'videoTitle\s
*:\s
*(["\'])(?P<title>(?:(?!\1).)+)\1',
60 r'<title>(?P<title>[^<]+)'), webpage, 'title',
61 default=None, group='title') or self._og_search_title(webpage)
63 bitrates = self._parse_json(
65 r'(?s)(?:src|bitrates)\s*=\s*({.+?});', webpage, 'bitrates',
67 video_id, transform_source=js_to_json, fatal=False)
70 for format_url in try_get(bitrates, lambda x: x['mp4'], list) or []:
71 if isinstance(format_url, compat_str):
72 height = self._search_regex(
73 r'(\d+)[pP]\.', format_url, 'height', default=None)
76 'format_id': format_field(height, template='%sp'),
77 'height': int(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',
96 self._sort_formats(formats)
98 thumbnail = self._og_search_thumbnail(webpage)
100 duration = int_or_none(self._search_regex(
101 r'videoDuration\s*:\s*(\d+)', webpage, 'duration', fatal=False))
106 'thumbnail': thumbnail,
107 'duration': duration,