You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class EggheadCourseIE(InfoExtractor):
  5. IE_DESC = 'egghead.io course'
  6. IE_NAME = 'egghead:course'
  7. _VALID_URL = r'https://egghead\.io/courses/(?P<id>[^/?#&]+)'
  8. _TEST = {
  9. 'url': 'https://egghead.io/courses/professor-frisby-introduces-composable-functional-javascript',
  10. 'playlist_count': 29,
  11. 'info_dict': {
  12. 'id': 'professor-frisby-introduces-composable-functional-javascript',
  13. 'title': 'Professor Frisby Introduces Composable Functional JavaScript',
  14. 'description': 're:(?s)^This course teaches the ubiquitous.*You\'ll start composing functionality before you know it.$',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. playlist_id = self._match_id(url)
  19. course = self._download_json(
  20. 'https://egghead.io/api/v1/series/%s' % playlist_id, playlist_id)
  21. entries = [
  22. self.url_result(
  23. 'wistia:%s' % lesson['wistia_id'], ie='Wistia',
  24. video_id=lesson['wistia_id'], video_title=lesson.get('title'))
  25. for lesson in course['lessons'] if lesson.get('wistia_id')]
  26. return self.playlist_result(
  27. entries, playlist_id, course.get('title'),
  28. course.get('description'))