3 import xml
.etree
.ElementTree
5 from .common
import InfoExtractor
19 class SlidesLiveIE(InfoExtractor
):
20 _VALID_URL
= r
'https?://slideslive\.com/(?:embed/(?:presentation/)?)?(?P<id>[0-9]+)'
22 # service_name = yoda, only XML slides info
23 'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
27 'title': 'GCC IA16 backend',
28 'timestamp': 1697793372,
29 'upload_date': '20231020',
30 'thumbnail': r
're:^https?://.*\.jpg',
31 'thumbnails': 'count:42',
32 'chapters': 'count:41',
36 'skip_download': 'm3u8',
39 # service_name = yoda, /v7/ slides
40 'url': 'https://slideslive.com/38935785',
44 'title': 'Offline Reinforcement Learning: From Algorithms to Practical Challenges',
45 'upload_date': '20231020',
46 'timestamp': 1697807002,
47 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
48 'thumbnails': 'count:640',
49 'chapters': 'count:639',
53 'skip_download': 'm3u8',
56 # service_name = yoda, /v1/ slides
57 'url': 'https://slideslive.com/38973182/how-should-a-machine-learning-researcher-think-about-ai-ethics',
61 'title': 'How Should a Machine Learning Researcher Think About AI Ethics?',
62 'upload_date': '20231020',
63 'thumbnail': r
're:^https?://.*\.jpg',
64 'timestamp': 1697822521,
65 'thumbnails': 'count:3',
66 'chapters': 'count:2',
70 'skip_download': 'm3u8',
73 # formerly youtube, converted to native
74 'url': 'https://slideslive.com/38897546/special-metaprednaska-petra-ludwiga-hodnoty-pro-lepsi-spolecnost',
75 'md5': '8a79b5e3d700837f40bd2afca3c8fa01',
79 'title': 'SPECIÁL: Meta-přednáška Petra Ludwiga - Hodnoty pro lepší společnost',
80 'thumbnail': r
're:^https?://.*\.jpg',
81 'upload_date': '20231029',
82 'timestamp': 1698588144,
83 'thumbnails': 'count:169',
84 'chapters': 'count:168',
88 'skip_download': 'm3u8',
91 # embed-only presentation, only XML slides info
92 'url': 'https://slideslive.com/embed/presentation/38925850',
96 'title': 'Towards a Deep Network Architecture for Structured Smoothness',
97 'thumbnail': r
're:^https?://.*\.jpg',
98 'thumbnails': 'count:8',
99 'timestamp': 1697803109,
100 'upload_date': '20231020',
101 'chapters': 'count:7',
105 'skip_download': 'm3u8',
108 # embed-only presentation, only JSON slides info, /v5/ slides (.png)
109 'url': 'https://slideslive.com/38979920/',
113 'title': 'MoReL: Multi-omics Relational Learning',
114 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
115 'thumbnails': 'count:7',
116 'timestamp': 1697824939,
117 'upload_date': '20231020',
118 'chapters': 'count:6',
122 'skip_download': 'm3u8',
126 'url': 'https://slideslive.com/38954074',
130 'title': 'Decentralized Attribution of Generative Models',
131 'thumbnail': r
're:^https?://.*\.jpg',
132 'thumbnails': 'count:16',
133 'timestamp': 1697814901,
134 'upload_date': '20231020',
135 'chapters': 'count:15',
139 'skip_download': 'm3u8',
143 'url': 'https://slideslive.com/38979570/',
147 'title': 'Efficient Active Search for Combinatorial Optimization Problems',
148 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
149 'thumbnails': 'count:9',
150 'timestamp': 1697824757,
151 'upload_date': '20231020',
152 'chapters': 'count:8',
156 'skip_download': 'm3u8',
160 'url': 'https://slideslive.com/embed/presentation/38979880?embed_parent_url=https%3A%2F%2Fedit.videoken.com%2F',
164 'title': 'The Representation Power of Neural Networks',
165 'timestamp': 1697824919,
166 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
167 'thumbnails': 'count:22',
168 'upload_date': '20231020',
169 'chapters': 'count:21',
173 'skip_download': 'm3u8',
176 # /v7/ slides, 2 video slides
177 'url': 'https://slideslive.com/embed/presentation/38979682?embed_container_origin=https%3A%2F%2Fedit.videoken.com',
180 'id': '38979682-playlist',
181 'title': 'LoRA: Low-Rank Adaptation of Large Language Models',
187 'title': 'LoRA: Low-Rank Adaptation of Large Language Models',
188 'timestamp': 1697824815,
189 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
190 'thumbnails': 'count:30',
191 'upload_date': '20231020',
192 'chapters': 'count:31',
197 'id': '38979682-021',
199 'title': 'LoRA: Low-Rank Adaptation of Large Language Models - Slide 021',
201 'timestamp': 1697824815,
202 'upload_date': '20231020',
206 'id': '38979682-024',
208 'title': 'LoRA: Low-Rank Adaptation of Large Language Models - Slide 024',
210 'timestamp': 1697824815,
211 'upload_date': '20231020',
215 'skip_download': 'm3u8',
218 # /v6/ slides, 1 video slide, edit.videoken.com embed
219 'url': 'https://slideslive.com/38979481/',
222 'id': '38979481-playlist',
223 'title': 'How to Train Your MAML to Excel in Few-Shot Classification',
229 'title': 'How to Train Your MAML to Excel in Few-Shot Classification',
230 'timestamp': 1697824716,
231 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
232 'thumbnails': 'count:43',
233 'upload_date': '20231020',
234 'chapters': 'count:43',
239 'id': '38979481-013',
241 'title': 'How to Train Your MAML to Excel in Few-Shot Classification - Slide 013',
243 'timestamp': 1697824716,
244 'upload_date': '20231020',
248 'skip_download': 'm3u8',
251 # /v3/ slides, .jpg and .png, service_name = youtube
252 'url': 'https://slideslive.com/embed/38932460/',
255 'display_id': '38932460',
257 'title': 'Active Learning for Hierarchical Multi-Label Classification',
258 'description': 'Watch full version of this video at https://slideslive.com/38932460.',
259 'channel': 'SlidesLive Videos - A',
260 'channel_id': 'UC62SdArr41t_-_fX40QCLRw',
261 'channel_url': 'https://www.youtube.com/channel/UC62SdArr41t_-_fX40QCLRw',
262 'uploader': 'SlidesLive Videos - A',
263 'uploader_id': '@slideslivevideos-a6075',
264 'uploader_url': 'https://www.youtube.com/@slideslivevideos-a6075',
265 'upload_date': '20200903',
266 'timestamp': 1697805922,
269 'live_status': 'not_live',
270 'playable_in_embed': True,
271 'availability': 'unlisted',
272 'categories': ['People & Blogs'],
274 'channel_follower_count': int,
277 'thumbnail': r
're:^https?://.*\.(?:jpg|png|webp)',
278 'thumbnails': 'count:21',
279 'chapters': 'count:20',
282 'skip_download': 'm3u8',
285 # /v3/ slides, .png only, service_name = yoda
286 'url': 'https://slideslive.com/38983994',
290 'title': 'Zero-Shot AutoML with Pretrained Models',
291 'timestamp': 1697826708,
292 'upload_date': '20231020',
293 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
294 'thumbnails': 'count:23',
295 'chapters': 'count:22',
299 'skip_download': 'm3u8',
302 # service_name = yoda
303 'url': 'https://slideslive.com/38903721/magic-a-scientific-resurrection-of-an-esoteric-legend',
304 'only_matching': True,
306 # dead link, service_name = url
307 'url': 'https://slideslive.com/38922070/learning-transferable-skills-1',
308 'only_matching': True,
310 # dead link, service_name = vimeo
311 'url': 'https://slideslive.com/38921896/retrospectives-a-venue-for-selfreflection-in-ml-research-3',
312 'only_matching': True,
316 # only XML slides info
317 'url': 'https://iclr.cc/virtual_2020/poster_Hklr204Fvr.html',
321 'title': 'Towards a Deep Network Architecture for Structured Smoothness',
322 'thumbnail': r
're:^https?://.*\.jpg',
323 'thumbnails': 'count:8',
324 'timestamp': 1697803109,
325 'upload_date': '20231020',
326 'chapters': 'count:7',
330 'skip_download': 'm3u8',
335 def _extract_embed_urls(cls
, url
, webpage
):
336 # Reference: https://slideslive.com/embed_presentation.js
337 for embed_id
in re
.findall(r
'(?s)new\s+SlidesLiveEmbed\s*\([^)]+\bpresentationId:\s*["\'](\d
+)["\']', webpage):
338 url_parsed = urllib.parse.urlparse(url)
339 origin = f'{url_parsed.scheme}://{url_parsed.netloc}'
340 yield update_url_query(
341 f'https://slideslive.com/embed/presentation/{embed_id}', {
342 'embed_parent_url': url,
343 'embed_container_origin': origin,
346 def _download_embed_webpage_handle(self, video_id, headers):
347 return self._download_webpage_handle(
348 f'https://slideslive.com/embed/presentation/{video_id}', video_id,
349 headers=headers, query=traverse_obj(headers, {
350 'embed_parent_url': 'Referer',
351 'embed_container_origin': 'Origin',
354 def _extract_custom_m3u8_info(self, m3u8_data):
358 'PRESENTATION-TITLE': 'title',
359 'PRESENTATION-UPDATED-AT': 'timestamp',
360 'PRESENTATION-THUMBNAIL': 'thumbnail',
361 'PLAYLIST-TYPE': 'playlist_type',
362 'VOD-VIDEO-SERVICE-NAME': 'service_name',
363 'VOD-VIDEO-ID': 'service_id',
364 'VOD-VIDEO-SERVERS': 'video_servers',
365 'VOD-SUBTITLES': 'subtitles',
366 'VOD-SLIDES-JSON-URL': 'slides_json_url',
367 'VOD-SLIDES-XML-URL': 'slides_xml_url',
370 for line in m3u8_data.splitlines():
371 if not line.startswith('#EXT-SL-'):
373 tag, _, value = line.partition(':')
374 key = lookup.get(tag[8:])
377 m3u8_dict[key] = value
379 # Some values are stringified JSON arrays
380 for key in ('video_servers', 'subtitles'):
382 m3u8_dict[key] = self._parse_json(m3u8_dict[key], None, fatal=False) or []
386 def _extract_formats_and_duration(self, cdn_hostname, path, video_id, skip_duration=False):
387 formats, duration = [], None
389 hls_formats = self._extract_m3u8_formats(
390 f'https://{cdn_hostname}/{path}/master.m3u8',
391 video_id, 'mp4', m3u8_id='hls', fatal=False, live=True)
393 if not skip_duration:
394 duration = self._extract_m3u8_vod_duration(
395 hls_formats[0]['url'], video_id, note='Extracting duration from HLS manifest')
396 formats.extend(hls_formats)
398 dash_formats = self._extract_mpd_formats(
399 f'https://{cdn_hostname}/{path}/master.mpd', video_id, mpd_id='dash', fatal=False)
401 if not duration and not skip_duration:
402 duration = self._extract_mpd_vod_duration(
403 f'https://{cdn_hostname}/{path}/master.mpd', video_id,
404 note='Extracting duration from DASH manifest')
405 formats.extend(dash_formats)
407 return formats, duration
409 def _real_extract(self, url):
410 video_id = self._match_id(url)
411 webpage, urlh = self._download_embed_webpage_handle(
412 video_id, headers=traverse_obj(parse_qs(url), {
413 'Referer': ('embed_parent_url', -1),
414 'Origin': ('embed_container_origin', -1)}))
415 redirect_url = urlh.url
416 if 'domain_not_allowed' in redirect_url:
417 domain = traverse_obj(parse_qs(redirect_url), ('allowed_domains[]', ...), get_all=False)
419 raise ExtractorError(
420 'This is an embed-only presentation. Try passing --referer', expected=True)
421 webpage, _ = self._download_embed_webpage_handle(video_id, headers={
422 'Referer': f'https://{domain}/',
423 'Origin': f'https://{domain}',
426 player_token = self._search_regex(r'data-player-token="([^
"]+)"', webpage, 'player token
')
427 player_data = self._download_webpage(
428 f'https
://ben
.slideslive
.com
/player
/{video_id}
', video_id,
429 note='Downloading player info
', query={'player_token
': player_token})
430 player_info = self._extract_custom_m3u8_info(player_data)
432 service_name = player_info['service_name
'].lower()
433 assert service_name in ('url
', 'yoda
', 'vimeo
', 'youtube
')
434 service_id = player_info['service_id
']
436 slide_url_template = 'https
://slides
.slideslive
.com
/%s/slides
/original
/%s%s'
437 slides, slides_info = {}, []
439 if player_info.get('slides_json_url
'):
440 slides = self._download_json(
441 player_info['slides_json_url
'], video_id, fatal=False,
442 note='Downloading slides JSON
', errnote=False) or {}
443 slide_ext_default = '.png
'
444 slide_quality = traverse_obj(slides, ('slide_qualities
', 0))
446 slide_ext_default = '.jpg
'
447 slide_url_template = f'https
://cdn
.slideslive
.com
/data
/presentations
/%s/slides
/{slide_quality}
/%s%s'
448 for slide_id, slide in enumerate(traverse_obj(slides, ('slides
', ...), expected_type=dict), 1):
450 slide_id, traverse_obj(slide, ('image
', 'name
')),
451 traverse_obj(slide, ('image
', 'extname
'), default=slide_ext_default),
452 int_or_none(slide.get('time
'), scale=1000)))
454 if not slides and player_info.get('slides_xml_url
'):
455 slides = self._download_xml(
456 player_info['slides_xml_url
'], video_id, fatal=False,
457 note='Downloading slides XML
', errnote='Failed to download slides info
')
458 if isinstance(slides, xml.etree.ElementTree.Element):
459 slide_url_template = 'https
://cdn
.slideslive
.com
/data
/presentations
/%s/slides
/big
/%s%s'
460 for slide_id, slide in enumerate(slides.findall('./slide
')):
462 slide_id, xpath_text(slide, './slideName
', 'name
'), '.jpg
',
463 int_or_none(xpath_text(slide, './timeSec
', 'time
'))))
465 chapters, thumbnails = [], []
466 if url_or_none(player_info.get('thumbnail
')):
467 thumbnails.append({'id': 'cover
', 'url
': player_info['thumbnail
']})
468 for slide_id, slide_path, slide_ext, start_time in slides_info:
471 'id': f'{slide_id
:03d
}',
472 'url
': slide_url_template % (video_id, slide_path, slide_ext),
475 'title
': f'Slide
{slide_id
:03d
}',
476 'start_time
': start_time,
480 for sub in traverse_obj(player_info, ('subtitles
', ...), expected_type=dict):
481 webvtt_url = url_or_none(sub.get('webvtt_url
'))
484 subtitles.setdefault(sub.get('language
') or 'en
', []).append({
491 'title
': player_info.get('title
') or self._html_search_meta('title
', webpage, default=''),
492 'timestamp
': unified_timestamp(player_info.get('timestamp
')),
493 'is_live
': player_info.get('playlist_type
') != 'vod
',
494 'thumbnails
': thumbnails,
495 'chapters
': chapters,
496 'subtitles
': subtitles,
499 if service_name == 'url
':
500 info['url
'] = service_id
501 elif service_name == 'yoda
':
502 formats, duration = self._extract_formats_and_duration(
503 player_info['video_servers
'][0], service_id, video_id)
505 'duration
': duration,
510 '_type
': 'url_transparent
',
512 'ie_key
': service_name.capitalize(),
513 'display_id
': video_id,
515 if service_name == 'vimeo
':
516 info['url
'] = smuggle_url(
517 f'https
://player
.vimeo
.com
/video
/{service_id}
',
520 video_slides = traverse_obj(slides, ('slides
', ..., 'video
', 'id'))
527 service_data = self._download_json(
528 f'https
://ben
.slideslive
.com
/player
/{video_id}
/slides_video_service_data
',
529 video_id, fatal=False, query={
530 'player_token
': player_token,
531 'videos
': ','.join(video_slides),
532 }, note='Downloading video slides info
', errnote='Failed to download video slides info
') or {}
534 for slide_id, slide in enumerate(traverse_obj(slides, ('slides
', ...)), 1):
535 if traverse_obj(slide, ('video
', 'service
')) != 'yoda
':
537 video_path = traverse_obj(slide, ('video
', 'id'))
538 cdn_hostname = traverse_obj(service_data, (
539 video_path, 'video_servers
', ...), get_all=False)
540 if not cdn_hostname or not video_path:
542 formats, _ = self._extract_formats_and_duration(
543 cdn_hostname, video_path, video_id, skip_duration=True)
547 'id': f'{video_id}
-{slide_id
:03d
}',
548 'title
': f'{info
["title"]} - Slide
{slide_id
:03d
}',
549 'timestamp
': info['timestamp
'],
550 'duration
': int_or_none(traverse_obj(slide, ('video
', 'duration_ms
')), scale=1000),
554 return self.playlist_result(entries(), f'{video_id}
-playlist
', info['title
'])