]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/craftsy.py
1 from .brightcove
import BrightcoveNewIE
2 from .common
import InfoExtractor
12 class CraftsyIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://www.craftsy.com/class/(?P<id>[a-z0-9_-]+)/'
15 'url': 'https://www.craftsy.com/class/the-midnight-quilt-show-season-5/',
17 'id': 'the-midnight-quilt-show-season-5',
18 'title': 'The Midnight Quilt Show Season 5',
19 'description': 'md5:113eda818e985d1a566625fb2f833b7a',
23 'url': 'https://www.craftsy.com/class/sew-your-own-designer-handbag/',
25 'id': 'sew-your-own-designer-handbag',
26 'title': 'Sew Your Own Designer Handbag',
27 'description': 'md5:8270d0ef5427d3c895a27351aeaac276',
29 'playlist_mincount': 1,
31 'url': 'https://www.craftsy.com/class/all-access-estes-park-wool-market/',
33 'id': 'all-access-estes-park-wool-market',
34 'title': 'All Access: Estes Park Wool Market',
35 'description': 'md5:aded1bd8d38ae2fae4dae936c0ae01e7',
40 def _real_extract(self
, url
):
41 video_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(url
, video_id
)
44 video_data
= self
._parse
_json
(self
._search
_regex
(
45 r
'class_video_player_vars\s*=\s*({.*})\s*;',
46 get_element_by_id('vidstore-classes_class-video-player-js-extra', webpage
),
47 'video data'), video_id
, transform_source
=js_to_json
)
49 account_id
= traverse_obj(video_data
, ('video_player', 'bc_account_id'))
52 class_preview
= traverse_obj(video_data
, ('video_player', 'class_preview'))
54 v_id
= class_preview
.get('video_id')
55 entries
.append(self
.url_result(
56 f
'http://players.brightcove.net/{account_id}/default_default/index.html?videoId={v_id}',
57 BrightcoveNewIE
, v_id
, class_preview
.get('title')))
59 if dict_get(video_data
, ('is_free', 'user_has_access')):
62 f
'http://players.brightcove.net/{account_id}/default_default/index.html?videoId={lesson["video_id"]}',
63 BrightcoveNewIE
, lesson
['video_id'], lesson
.get('title'))
64 for lesson
in video_data
['lessons']]
66 return self
.playlist_result(
67 entries
, video_id
, video_data
.get('class_title'),
68 self
._html
_search
_meta
(('og:description', 'description'), webpage
, default
=None))