]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/slideslive.py
Prepare to upload.
[youtubedl] / 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 smuggle_url
6
7
8 class SlidesLiveIE(InfoExtractor):
9 _VALID_URL = r'https?://slideslive\.com/(?P<id>[0-9]+)'
10 _TESTS = [{
11 # video_service_name = YOUTUBE
12 'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
13 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f',
14 'info_dict': {
15 'id': 'LMtgR8ba0b0',
16 'ext': 'mp4',
17 'title': 'GCC IA16 backend',
18 'description': 'Watch full version of this video at https://slideslive.com/38902413.',
19 'uploader': 'SlidesLive Videos - A',
20 'uploader_id': 'UC62SdArr41t_-_fX40QCLRw',
21 'upload_date': '20170925',
22 }
23 }, {
24 # video_service_name = youtube
25 'url': 'https://slideslive.com/38903721/magic-a-scientific-resurrection-of-an-esoteric-legend',
26 'only_matching': True,
27 }, {
28 # video_service_name = url
29 'url': 'https://slideslive.com/38922070/learning-transferable-skills-1',
30 'only_matching': True,
31 }, {
32 # video_service_name = vimeo
33 'url': 'https://slideslive.com/38921896/retrospectives-a-venue-for-selfreflection-in-ml-research-3',
34 'only_matching': True,
35 }]
36
37 def _real_extract(self, url):
38 video_id = self._match_id(url)
39 video_data = self._download_json(
40 'https://ben.slideslive.com/player/' + video_id, video_id)
41 service_name = video_data['video_service_name'].lower()
42 assert service_name in ('url', 'vimeo', 'youtube')
43 service_id = video_data['video_service_id']
44 info = {
45 'id': video_id,
46 'thumbnail': video_data.get('thumbnail'),
47 'url': service_id,
48 }
49 if service_name == 'url':
50 info['title'] = video_data['title']
51 else:
52 info.update({
53 '_type': 'url_transparent',
54 'ie_key': service_name.capitalize(),
55 'title': video_data.get('title'),
56 })
57 if service_name == 'vimeo':
58 info['url'] = smuggle_url(
59 'https://player.vimeo.com/video/' + service_id,
60 {'http_headers': {'Referer': url}})
61 return info