1 from .common
import InfoExtractor
2 from ..utils
import clean_html
, float_or_none
, traverse_obj
, try_call
5 class JixieBaseIE(InfoExtractor
):
8 https://jixie.atlassian.net/servicedesk/customer/portal/2/article/1339654214?src=-1456335525,
9 https://scripts.jixie.media/jxvideo.3.1.min.js
12 def _extract_data_from_jixie_id(self
, display_id
, video_id
, webpage
):
13 json_data
= self
._download
_json
(
14 'https://apidam.jixie.io/api/public/stream', display_id
,
15 query
={'metadata': 'full', 'video_id': video_id
})['data']
17 formats
, subtitles
= [], {}
18 for stream
in json_data
['streams']:
19 if stream
.get('type') == 'HLS':
20 fmt
, sub
= self
._extract
_m
3u8_formats
_and
_subtitles
(stream
.get('url'), display_id
, ext
='mp4')
21 if json_data
.get('drm'):
25 self
._merge
_subtitles
(sub
, target
=subtitles
)
28 'url': stream
.get('url'),
29 'width': stream
.get('width'),
30 'height': stream
.get('height'),
36 'display_id': display_id
,
38 'subtitles': subtitles
,
39 'title': json_data
.get('title') or self
._html
_search
_meta
(['og:title', 'twitter:title'], webpage
),
40 'description': (clean_html(traverse_obj(json_data
, ('metadata', 'description')))
41 or self
._html
_search
_meta
(['description', 'og:description', 'twitter:description'], webpage
)),
42 'thumbnails': traverse_obj(json_data
, ('metadata', 'thumbnails')),
43 'duration': float_or_none(traverse_obj(json_data
, ('metadata', 'duration'))),
44 'tags': try_call(lambda: (json_data
['metadata']['keywords'] or None).split(',')),
45 'categories': try_call(lambda: (json_data
['metadata']['categories'] or None).split(',')),
46 'uploader_id': json_data
.get('owner_id'),