]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/kelbyone.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..utils
import int_or_none
8 class KelbyOneIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://members\.kelbyone\.com/course/(?P<id>[^$&?#/]+)'
12 'url': 'https://members.kelbyone.com/course/glyn-dewis-mastering-selections/',
13 'playlist_mincount': 1,
15 'id': 'glyn-dewis-mastering-selections',
16 'title': 'Trailer - Mastering Selections in Photoshop',
22 'title': 'Trailer - Mastering Selections in Photoshop',
23 'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
24 'thumbnail': 'https://content.jwplatform.com/v2/media/MkiOnLqK/poster.jpg?width=720',
25 'timestamp': 1601568639,
27 'upload_date': '20201001',
32 def _entries(self
, playlist
):
34 video_id
= item
['mediaid']
36 'url': image
.get('src'),
37 'width': int_or_none(image
.get('width')),
38 } for image
in item
.get('images') or []]
39 formats
, subtitles
= [], {}
40 for source
in item
.get('sources') or []:
41 if not source
.get('file'):
43 if source
.get('type') == 'application/vnd.apple.mpegurl':
44 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(source
['file'], video_id
)
46 subtitles
= self
._merge
_subtitles
(subs
, subtitles
)
47 elif source
.get('type') == 'audio/mp4':
49 'format_id': source
.get('label'),
50 'url': source
['file'],
55 'format_id': source
.get('label'),
56 'height': source
.get('height'),
57 'width': source
.get('width'),
58 'url': source
['file'],
60 for track
in item
.get('tracks'):
61 if track
.get('kind') == 'captions' and track
.get('file'):
62 subtitles
.setdefault('en', []).append({
65 self
._sort
_formats
(formats
)
68 'title': item
['title'],
69 'description': item
.get('description'),
70 'thumbnails': thumbnails
,
71 'thumbnail': item
.get('image'),
72 'timestamp': item
.get('pubdate'),
73 'duration': item
.get('duration'),
75 'subtitles': subtitles
,
78 def _real_extract(self
, url
):
79 item_id
= self
._match
_id
(url
)
80 webpage
= self
._download
_webpage
(url
, item_id
)
81 playlist_url
= self
._html
_search
_regex
(r
'playlist"\:"(https.*content\.jwplatform\.com.*json)"', webpage
, 'playlist url').replace('\\', '')
82 course_data
= self
._download
_json
(playlist_url
, item_id
)
83 return self
.playlist_result(self
._entries
(course_data
['playlist']), item_id
,
84 course_data
.get('title'), course_data
.get('description'))