]>
Commit | Line | Data |
---|---|---|
d0f2d641 | 1 | from .common import InfoExtractor |
29f7c58a | 2 | from ..utils import ( |
3 | bool_or_none, | |
4 | smuggle_url, | |
5 | try_get, | |
6 | url_or_none, | |
7 | ) | |
d0f2d641 JW |
8 | |
9 | ||
10 | class SlidesLiveIE(InfoExtractor): | |
11 | _VALID_URL = r'https?://slideslive\.com/(?P<id>[0-9]+)' | |
7aaf4cd2 | 12 | _WORKING = False |
d0f2d641 | 13 | _TESTS = [{ |
aa1d5eb9 | 14 | # video_service_name = YOUTUBE |
d0f2d641 JW |
15 | 'url': 'https://slideslive.com/38902413/gcc-ia16-backend', |
16 | 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f', | |
17 | 'info_dict': { | |
18 | 'id': 'LMtgR8ba0b0', | |
19 | 'ext': 'mp4', | |
b33a05d2 RA |
20 | 'title': 'GCC IA16 backend', |
21 | 'description': 'Watch full version of this video at https://slideslive.com/38902413.', | |
22 | 'uploader': 'SlidesLive Videos - A', | |
d0f2d641 | 23 | 'uploader_id': 'UC62SdArr41t_-_fX40QCLRw', |
29f7c58a | 24 | 'timestamp': 1597615266, |
d0f2d641 JW |
25 | 'upload_date': '20170925', |
26 | } | |
29f7c58a | 27 | }, { |
28 | # video_service_name = yoda | |
29 | 'url': 'https://slideslive.com/38935785', | |
30 | 'md5': '575cd7a6c0acc6e28422fe76dd4bcb1a', | |
31 | 'info_dict': { | |
32 | 'id': 'RMraDYN5ozA_', | |
33 | 'ext': 'mp4', | |
34 | 'title': 'Offline Reinforcement Learning: From Algorithms to Practical Challenges', | |
35 | }, | |
aa1d5eb9 RA |
36 | }, { |
37 | # video_service_name = youtube | |
38 | 'url': 'https://slideslive.com/38903721/magic-a-scientific-resurrection-of-an-esoteric-legend', | |
39 | 'only_matching': True, | |
73d8f3a6 RA |
40 | }, { |
41 | # video_service_name = url | |
42 | 'url': 'https://slideslive.com/38922070/learning-transferable-skills-1', | |
43 | 'only_matching': True, | |
44 | }, { | |
45 | # video_service_name = vimeo | |
46 | 'url': 'https://slideslive.com/38921896/retrospectives-a-venue-for-selfreflection-in-ml-research-3', | |
47 | 'only_matching': True, | |
d0f2d641 JW |
48 | }] |
49 | ||
50 | def _real_extract(self, url): | |
51 | video_id = self._match_id(url) | |
52 | video_data = self._download_json( | |
b33a05d2 | 53 | 'https://ben.slideslive.com/player/' + video_id, video_id) |
aa1d5eb9 | 54 | service_name = video_data['video_service_name'].lower() |
29f7c58a | 55 | assert service_name in ('url', 'yoda', 'vimeo', 'youtube') |
73d8f3a6 | 56 | service_id = video_data['video_service_id'] |
29f7c58a | 57 | subtitles = {} |
58 | for sub in try_get(video_data, lambda x: x['subtitles'], list) or []: | |
59 | if not isinstance(sub, dict): | |
60 | continue | |
61 | webvtt_url = url_or_none(sub.get('webvtt_url')) | |
62 | if not webvtt_url: | |
63 | continue | |
64 | lang = sub.get('language') or 'en' | |
65 | subtitles.setdefault(lang, []).append({ | |
66 | 'url': webvtt_url, | |
67 | }) | |
73d8f3a6 RA |
68 | info = { |
69 | 'id': video_id, | |
70 | 'thumbnail': video_data.get('thumbnail'), | |
29f7c58a | 71 | 'is_live': bool_or_none(video_data.get('is_live')), |
72 | 'subtitles': subtitles, | |
73d8f3a6 | 73 | } |
29f7c58a | 74 | if service_name in ('url', 'yoda'): |
73d8f3a6 | 75 | info['title'] = video_data['title'] |
29f7c58a | 76 | if service_name == 'url': |
77 | info['url'] = service_id | |
78 | else: | |
79 | formats = [] | |
80 | _MANIFEST_PATTERN = 'https://01.cdn.yoda.slideslive.com/%s/master.%s' | |
81 | # use `m3u8` entry_protocol until EXT-X-MAP is properly supported by `m3u8_native` entry_protocol | |
82 | formats.extend(self._extract_m3u8_formats( | |
83 | _MANIFEST_PATTERN % (service_id, 'm3u8'), | |
84 | service_id, 'mp4', m3u8_id='hls', fatal=False)) | |
85 | formats.extend(self._extract_mpd_formats( | |
86 | _MANIFEST_PATTERN % (service_id, 'mpd'), service_id, | |
87 | mpd_id='dash', fatal=False)) | |
88 | self._sort_formats(formats) | |
89 | info.update({ | |
90 | 'id': service_id, | |
91 | 'formats': formats, | |
92 | }) | |
73d8f3a6 RA |
93 | else: |
94 | info.update({ | |
b33a05d2 | 95 | '_type': 'url_transparent', |
29f7c58a | 96 | 'url': service_id, |
73d8f3a6 | 97 | 'ie_key': service_name.capitalize(), |
b33a05d2 | 98 | 'title': video_data.get('title'), |
73d8f3a6 RA |
99 | }) |
100 | if service_name == 'vimeo': | |
101 | info['url'] = smuggle_url( | |
102 | 'https://player.vimeo.com/video/' + service_id, | |
103 | {'http_headers': {'Referer': url}}) | |
104 | return info |