diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2017-01-09 11:24:40 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2017-01-09 11:24:40 +0100 |
commit | 8084951b7f3886cbd57faab0c15f4f2ce3580779 (patch) | |
tree | c18a13874ce80ba6abcd2a4ed1b73528370a8b85 /youtube_dl/extractor/egghead.py | |
parent | e7ea724cb9cca344b4f486231f12a76918df80ee (diff) |
[egghead:course] Add support for egghead.io course playlists
Individual egghead videos are already handled by the generic/Wistia extractors.
Diffstat (limited to 'youtube_dl/extractor/egghead.py')
-rw-r--r-- | youtube_dl/extractor/egghead.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/youtube_dl/extractor/egghead.py b/youtube_dl/extractor/egghead.py new file mode 100644 index 000000000..db921465e --- /dev/null +++ b/youtube_dl/extractor/egghead.py @@ -0,0 +1,39 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class EggheadCourseIE(InfoExtractor): + IE_DESC = 'egghead.io course' + IE_NAME = 'egghead:course' + _VALID_URL = r'https://egghead\.io/courses/(?P<id>[a-zA-Z_0-9-]+)' + _TEST = { + 'url': 'https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript', + 'playlist_count': 29, + 'info_dict': { + 'id': 'professor-frisby-introduces-composable-functional-javascript', + 'title': 'Professor Frisby Introduces Composable Functional JavaScript', + 'description': 're:(?s)^This course teaches the ubiquitous.*You\'ll start composing functionality before you know it.$', + }, + } + + def _real_extract(self, url): + playlist_id = self._match_id(url) + webpage = self._download_webpage(url, playlist_id) + + title = self._html_search_regex(r'<h1 class="title">([^<]+)</h1>', webpage, 'title') + ul = self._search_regex(r'(?s)<ul class="series-lessons-list">(.*?)</ul>', webpage, 'session list') + + found = re.findall(r'(?s)<a class="[^"]*"\s*href="([^"]+)">\s*<li class="item', ul) + entries = [self.url_result(m) for m in found] + + return { + '_type': 'playlist', + 'id': playlist_id, + 'title': title, + 'description': self._og_search_description(webpage), + 'entries': entries, + } |