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