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.

34 lines
1.2 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. 'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
  9. 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f',
  10. 'info_dict': {
  11. 'id': 'LMtgR8ba0b0',
  12. 'ext': 'mp4',
  13. 'title': '38902413: external video',
  14. 'description': '3890241320170925-9-1yd6ech.mp4',
  15. 'uploader': 'SlidesLive Administrator',
  16. 'uploader_id': 'UC62SdArr41t_-_fX40QCLRw',
  17. 'upload_date': '20170925',
  18. }
  19. }]
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. video_data = self._download_json(
  23. url, video_id, headers={'Accept': 'application/json'})
  24. service_name = video_data['video_service_name']
  25. if service_name == 'YOUTUBE':
  26. yt_video_id = video_data['video_service_id']
  27. return self.url_result(yt_video_id, 'Youtube', video_id=yt_video_id)
  28. else:
  29. raise ExtractorError(
  30. 'Unsupported service name: {0}'.format(service_name), expected=True)