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.

39 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import ExtractorError
  5. class SlidesLiveIE(InfoExtractor):
  6. _VALID_URL = r'https?://slideslive\.com/(?P<id>[0-9]+)'
  7. _TESTS = [{
  8. # video_service_name = YOUTUBE
  9. 'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
  10. 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f',
  11. 'info_dict': {
  12. 'id': 'LMtgR8ba0b0',
  13. 'ext': 'mp4',
  14. 'title': '38902413: external video',
  15. 'description': '3890241320170925-9-1yd6ech.mp4',
  16. 'uploader': 'SlidesLive Administrator',
  17. 'uploader_id': 'UC62SdArr41t_-_fX40QCLRw',
  18. 'upload_date': '20170925',
  19. }
  20. }, {
  21. # video_service_name = youtube
  22. 'url': 'https://slideslive.com/38903721/magic-a-scientific-resurrection-of-an-esoteric-legend',
  23. 'only_matching': True,
  24. }]
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. video_data = self._download_json(
  28. url, video_id, headers={'Accept': 'application/json'})
  29. service_name = video_data['video_service_name'].lower()
  30. if service_name == 'youtube':
  31. yt_video_id = video_data['video_service_id']
  32. return self.url_result(yt_video_id, 'Youtube', video_id=yt_video_id)
  33. else:
  34. raise ExtractorError(
  35. 'Unsupported service name: {0}'.format(service_name), expected=True)