From 8084951b7f3886cbd57faab0c15f4f2ce3580779 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 9 Jan 2017 11:24:40 +0100 Subject: [PATCH] [egghead:course] Add support for egghead.io course playlists Individual egghead videos are already handled by the generic/Wistia extractors. --- ChangeLog | 5 +++- youtube_dl/extractor/egghead.py | 39 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 youtube_dl/extractor/egghead.py diff --git a/ChangeLog b/ChangeLog index da9cf24af4..c7cee54127 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +version + ++ [egghead:course] Add support for egghead.io courses + version 2017.01.08 Core @@ -14,7 +18,6 @@ Extractors * [comedycentral/mtv] Add support for HLS videos (#11600) * [discoverygo] Fix JSON data parsing (#11219, #11522) - version 2017.01.05 Extractors diff --git a/youtube_dl/extractor/egghead.py b/youtube_dl/extractor/egghead.py new file mode 100644 index 0000000000..db921465e1 --- /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[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'

([^<]+)

', webpage, 'title') + ul = self._search_regex(r'(?s)
    (.*?)
', webpage, 'session list') + + found = re.findall(r'(?s)\s*