]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/egghead.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class EggheadCourseIE(InfoExtractor
):
13 IE_DESC
= 'egghead.io course'
14 IE_NAME
= 'egghead:course'
15 _VALID_URL
= r
'https://egghead\.io/courses/(?P<id>[^/?#&]+)'
17 'url': 'https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript',
20 'id': 'professor-frisby-introduces-composable-functional-javascript',
21 'title': 'Professor Frisby Introduces Composable Functional JavaScript',
22 'description': 're:(?s)^This course teaches the ubiquitous.*You\'ll start composing functionality before you know it.$',
26 def _real_extract(self
, url
):
27 playlist_id
= self
._match
_id
(url
)
29 course
= self
._download
_json
(
30 'https://egghead.io/api/v1/series/%s' % playlist_id
, playlist_id
)
34 'wistia:%s' % lesson
['wistia_id'], ie
='Wistia',
35 video_id
=lesson
['wistia_id'], video_title
=lesson
.get('title'))
36 for lesson
in course
['lessons'] if lesson
.get('wistia_id')]
38 return self
.playlist_result(
39 entries
, playlist_id
, course
.get('title'),
40 course
.get('description'))
43 class EggheadLessonIE(InfoExtractor
):
44 IE_DESC
= 'egghead.io lesson'
45 IE_NAME
= 'egghead:lesson'
46 _VALID_URL
= r
'https://egghead\.io/lessons/(?P<id>[^/?#&]+)'
48 'url': 'https://egghead.io/lessons/javascript-linear-data-flow-with-container-style-types-box',
52 'title': 'Create linear data flow with container style types (Box)',
53 'description': 'md5:9aa2cdb6f9878ed4c39ec09e85a8150e',
54 'thumbnail': r
're:^https?:.*\.jpg$',
55 'timestamp': 1481296768,
56 'upload_date': '20161209',
59 'tags': ['javascript', 'free'],
62 'skip_download': True,
66 def _real_extract(self
, url
):
67 lesson_id
= self
._match
_id
(url
)
69 lesson
= self
._download
_json
(
70 'https://egghead.io/api/v1/lessons/%s' % lesson_id
, lesson_id
)
73 '_type': 'url_transparent',
75 'url': 'wistia:%s' % lesson
['wistia_id'],
76 'id': lesson
['wistia_id'],
77 'title': lesson
.get('title'),
78 'description': lesson
.get('summary'),
79 'thumbnail': lesson
.get('thumb_nail'),
80 'timestamp': unified_timestamp(lesson
.get('published_at')),
81 'duration': int_or_none(lesson
.get('duration')),
82 'view_count': int_or_none(lesson
.get('plays_count')),
83 'tags': try_get(lesson
, lambda x
: x
['tag_list'], list),