aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantiago Calcagno <santicalcagno@gmail.com>2017-06-13 12:32:04 -0300
committerSergey M․ <dstftw@gmail.com>2017-07-09 17:30:25 +0700
commited84454d358f3cbfdc43dab31328b165f9c72c68 (patch)
treea0baccbed321b59f735a9426e701239823bcb987
parenta02682fd13ce5ba88d2508c90559eaa7f43b65d5 (diff)
[egghead:course] Fix extraction
-rw-r--r--youtube_dl/extractor/egghead.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/youtube_dl/extractor/egghead.py b/youtube_dl/extractor/egghead.py
index db921465e..01fcdb6cf 100644
--- a/youtube_dl/extractor/egghead.py
+++ b/youtube_dl/extractor/egghead.py
@@ -1,8 +1,6 @@
# coding: utf-8
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
@@ -22,18 +20,18 @@ class EggheadCourseIE(InfoExtractor):
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')
+ api_url = 'https://egghead.io/api/v1/series/' + playlist_id
+ course = self._download_json(api_url, playlist_id)
+ title = course.get('title')
+ description = course.get('description')
- found = re.findall(r'(?s)<a class="[^"]*"\s*href="([^"]+)">\s*<li class="item', ul)
- entries = [self.url_result(m) for m in found]
+ lessons = course.get('lessons')
+ entries = [{'_type': 'url', 'ie_key': 'Wistia', 'url': 'wistia:' + l.get('wistia_id')} for l in lessons]
return {
'_type': 'playlist',
'id': playlist_id,
'title': title,
- 'description': self._og_search_description(webpage),
+ 'description': description,
'entries': entries,
}