1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-06 01:22:35 +00:00

[egghead:course] Fix extraction

This commit is contained in:
Santiago Calcagno 2017-06-13 12:32:04 -03:00 committed by Sergey M․
parent a02682fd13
commit ed84454d35
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -1,8 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
@ -22,18 +20,18 @@ class EggheadCourseIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id) 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')
title = self._html_search_regex(r'<h1 class="title">([^<]+)</h1>', webpage, 'title') lessons = course.get('lessons')
ul = self._search_regex(r'(?s)<ul class="series-lessons-list">(.*?)</ul>', webpage, 'session list') entries = [{'_type': 'url', 'ie_key': 'Wistia', 'url': 'wistia:' + l.get('wistia_id')} for l in lessons]
found = re.findall(r'(?s)<a class="[^"]*"\s*href="([^"]+)">\s*<li class="item', ul)
entries = [self.url_result(m) for m in found]
return { return {
'_type': 'playlist', '_type': 'playlist',
'id': playlist_id, 'id': playlist_id,
'title': title, 'title': title,
'description': self._og_search_description(webpage), 'description': description,
'entries': entries, 'entries': entries,
} }