1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
5 class KelbyOneIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://members\.kelbyone\.com/course/(?P<id>[^$&?#/]+)'
10 'url': 'https://members.kelbyone.com/course/glyn-dewis-mastering-selections/',
11 'playlist_mincount': 1,
13 'id': 'glyn-dewis-mastering-selections',
14 'title': 'Trailer - Mastering Selections in Photoshop',
20 'title': 'Trailer - Mastering Selections in Photoshop',
21 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
22 'thumbnail': 'https://content.jwplatform.com/v2/media/MkiOnLqK/poster.jpg?width=720',
23 'timestamp': 1601568639,
25 'upload_date': '20201001',
30 def _entries(self
, playlist
):
32 video_id
= item
['mediaid']
34 'url': image
.get('src'),
35 'width': int_or_none(image
.get('width')),
36 } for image
in item
.get('images') or []]
37 formats
, subtitles
= [], {}
38 for source
in item
.get('sources') or []:
39 if not source
.get('file'):
41 if source
.get('type') == 'application/vnd.apple.mpegurl':
42 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(source
['file'], video_id
)
44 subtitles
= self
._merge
_subtitles
(subs
, subtitles
)
45 elif source
.get('type') == 'audio/mp4':
47 'format_id': source
.get('label'),
48 'url': source
['file'],
53 'format_id': source
.get('label'),
54 'height': source
.get('height'),
55 'width': source
.get('width'),
56 'url': source
['file'],
58 for track
in item
.get('tracks'):
59 if track
.get('kind') == 'captions' and track
.get('file'):
60 subtitles
.setdefault('en', []).append({
65 'title': item
['title'],
66 'description': item
.get('description'),
67 'thumbnails': thumbnails
,
68 'thumbnail': item
.get('image'),
69 'timestamp': item
.get('pubdate'),
70 'duration': item
.get('duration'),
72 'subtitles': subtitles
,
75 def _real_extract(self
, url
):
76 item_id
= self
._match
_id
(url
)
77 webpage
= self
._download
_webpage
(url
, item_id
)
78 playlist_url
= self
._html
_search
_regex
(r
'playlist"\:"(https.*content\.jwplatform\.com.*json)"', webpage
, 'playlist url').replace('\\', '')
79 course_data
= self
._download
_json
(playlist_url
, item_id
)
80 return self
.playlist_result(self
._entries
(course_data
['playlist']), item_id
,
81 course_data
.get('title'), course_data
.get('description'))