]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/kelbyone.py
1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
5 class KelbyOneIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://members\.kelbyone\.com/course/(?P<id>[^$&?#/]+)'
9 'url': 'https://members.kelbyone.com/course/glyn-dewis-mastering-selections/',
10 'playlist_mincount': 1,
12 'id': 'glyn-dewis-mastering-selections',
13 'title': 'Trailer - Mastering Selections in Photoshop',
19 'title': 'Trailer - Mastering Selections in Photoshop',
20 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
21 'thumbnail': 'https://content.jwplatform.com/v2/media/MkiOnLqK/poster.jpg?width=720',
22 'timestamp': 1601568639,
24 'upload_date': '20201001',
29 def _entries(self
, playlist
):
31 video_id
= item
['mediaid']
33 'url': image
.get('src'),
34 'width': int_or_none(image
.get('width')),
35 } for image
in item
.get('images') or []]
36 formats
, subtitles
= [], {}
37 for source
in item
.get('sources') or []:
38 if not source
.get('file'):
40 if source
.get('type') == 'application/vnd.apple.mpegurl':
41 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(source
['file'], video_id
)
43 subtitles
= self
._merge
_subtitles
(subs
, subtitles
)
44 elif source
.get('type') == 'audio/mp4':
46 'format_id': source
.get('label'),
47 'url': source
['file'],
52 'format_id': source
.get('label'),
53 'height': source
.get('height'),
54 'width': source
.get('width'),
55 'url': source
['file'],
57 for track
in item
.get('tracks'):
58 if track
.get('kind') == 'captions' and track
.get('file'):
59 subtitles
.setdefault('en', []).append({
62 self
._sort
_formats
(formats
)
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'))