mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-26 21:59:08 +01:00
add vodcast/podcast and some more fix
- vodcast: slides and main video are shown side by side - podcast: audio only - add one more acceptable slide file name template - provide playbackTicket in slide image url
This commit is contained in:
parent
518bc52224
commit
04c4c807a2
1 changed files with 20 additions and 12 deletions
|
@ -6,6 +6,7 @@ from .common import InfoExtractor
|
|||
from ..utils import (
|
||||
ExtractorError,
|
||||
float_or_none,
|
||||
join_nonempty,
|
||||
mimetype2ext,
|
||||
smuggle_url,
|
||||
str_or_none,
|
||||
|
@ -93,16 +94,12 @@ class MediasiteIE(InfoExtractor):
|
|||
'ext': 'mp4',
|
||||
'title': 'Practical Prevention, Detection and Responses to the New Threat Landscape',
|
||||
'description': r're:^The bad guys aren’t standing still, and neither is Okta',
|
||||
'thumbnail': 'https://events7.mediasite.com/Mediasite/FileServer/Presentation/a7812390a2d44739ae857527e05776091d/16e2f205-41a7-4ea5-a031-5c6152afc7bf.jpg?playbackTicket=be2577e1d1fa4629abc0a2f56465b1a7',
|
||||
'thumbnail': r're:^https://events7\.mediasite\.com/Mediasite/FileServer/Presentation/a7812390a2d44739ae857527e05776091d/16e2f205-41a7-4ea5-a031-5c6152afc7bf\.jpg',
|
||||
'cast': ['Franklin Rosado', 'Alex Bovee'],
|
||||
'duration': 2415.487,
|
||||
'timestamp': 1472567400,
|
||||
'upload_date': '20160830',
|
||||
},
|
||||
'params': {
|
||||
# frag 1 too small (only 768B)
|
||||
'skip_download': True,
|
||||
},
|
||||
},
|
||||
{
|
||||
'url': 'https://collegerama.tudelft.nl/Mediasite/Showcase/livebroadcast/Presentation/ada7020854f743c49fbb45c9ec7dbb351d',
|
||||
|
@ -135,9 +132,9 @@ class MediasiteIE(InfoExtractor):
|
|||
|
||||
def __extract_slides(self, *, stream_id, snum, stream, duration, images):
|
||||
slide_base_url = stream['SlideBaseUrl']
|
||||
|
||||
playback_ticket = stream.get('SlidePlaybackTicketId')
|
||||
fname_template = stream['SlideImageFileNameTemplate']
|
||||
if fname_template != 'slide_{0:D4}.jpg':
|
||||
if fname_template != 'slide_{0:D4}.jpg' and fname_template != 'slide_%s_{0:D4}.jpg' % stream_id:
|
||||
self.report_warning('Unusual slide file name template; report a bug if slide downloading fails')
|
||||
fname_template = re.sub(r'\{0:D([0-9]+)\}', r'{0:0\1}', fname_template)
|
||||
|
||||
|
@ -163,7 +160,8 @@ class MediasiteIE(InfoExtractor):
|
|||
expected_type=(int, float))
|
||||
|
||||
fragments.append({
|
||||
'path': fname_template.format(slide.get('Number', i + 1)),
|
||||
'path': join_nonempty(fname_template.format(slide.get('Number', i + 1)),
|
||||
playback_ticket, delim='?playbackTicket='),
|
||||
'duration': (next_time - slide['Time']) / 1000,
|
||||
})
|
||||
|
||||
|
@ -209,13 +207,13 @@ class MediasiteIE(InfoExtractor):
|
|||
}).encode())['d']
|
||||
|
||||
presentation = player_options['Presentation']
|
||||
title = presentation['Title']
|
||||
|
||||
if presentation is None:
|
||||
raise ExtractorError(
|
||||
'Mediasite says: {}'.format(player_options['PlayerPresentationStatusMessage']),
|
||||
expected=True)
|
||||
|
||||
title = (presentation.get('Title')
|
||||
or self._html_extract_title(webpage, 'title', fatal=False))
|
||||
thumbnails = []
|
||||
formats = []
|
||||
for snum, stream in enumerate(presentation['Streams']):
|
||||
|
@ -251,7 +249,7 @@ class MediasiteIE(InfoExtractor):
|
|||
fatal=False))
|
||||
elif ext in ('m3u', 'm3u8'):
|
||||
stream_formats.extend(self._extract_m3u8_formats(
|
||||
video_url, resource_id,
|
||||
video_url, resource_id, media_type.lower(),
|
||||
m3u8_id=f'{stream_id}-{snum}.{unum}',
|
||||
fatal=False))
|
||||
else:
|
||||
|
@ -261,7 +259,8 @@ class MediasiteIE(InfoExtractor):
|
|||
'ext': ext,
|
||||
})
|
||||
|
||||
images = traverse_obj(player_options, ('PlayerLayoutOptions', 'Images', {dict}), default={})
|
||||
images = traverse_obj(
|
||||
player_options, ('PlayerLayoutOptions', 'Images', {dict}), default={})
|
||||
if stream.get('HasSlideContent'):
|
||||
stream_formats.append(self.__extract_slides(
|
||||
stream_id=stream_id,
|
||||
|
@ -285,6 +284,15 @@ class MediasiteIE(InfoExtractor):
|
|||
})
|
||||
formats.extend(stream_formats)
|
||||
|
||||
for i, cast_url in enumerate(('PodcastUrl', 'VodcastUrl')):
|
||||
if url_or_none(presentation.get(cast_url)):
|
||||
formats.append({
|
||||
'format_id': cast_url.lower().replace('url', ''),
|
||||
'url': presentation.get(cast_url).split('?attachmentName=')[0],
|
||||
'vcodec': None if i else 'none',
|
||||
'preference': None if i else -2,
|
||||
})
|
||||
|
||||
# XXX: Presentation['Presenters']
|
||||
# XXX: Presentation['Transcript']
|
||||
|
||||
|
|
Loading…
Reference in a new issue