mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-03-09 12:50:23 -05:00
Merge 04c4c807a2
into 05c8023a27
This commit is contained in:
commit
909f31c20e
1 changed files with 34 additions and 8 deletions
|
@ -6,6 +6,7 @@
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
|
join_nonempty,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
|
@ -86,6 +87,20 @@ class MediasiteIE(InfoExtractor):
|
||||||
'duration': 7794,
|
'duration': 7794,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://events7.mediasite.com/Mediasite/Play/a7812390a2d44739ae857527e05776091d',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'a7812390a2d44739ae857527e05776091d',
|
||||||
|
'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': 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',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'url': 'https://collegerama.tudelft.nl/Mediasite/Showcase/livebroadcast/Presentation/ada7020854f743c49fbb45c9ec7dbb351d',
|
'url': 'https://collegerama.tudelft.nl/Mediasite/Showcase/livebroadcast/Presentation/ada7020854f743c49fbb45c9ec7dbb351d',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -117,9 +132,9 @@ def _extract_embed_urls(cls, url, webpage):
|
||||||
|
|
||||||
def __extract_slides(self, *, stream_id, snum, stream, duration, images):
|
def __extract_slides(self, *, stream_id, snum, stream, duration, images):
|
||||||
slide_base_url = stream['SlideBaseUrl']
|
slide_base_url = stream['SlideBaseUrl']
|
||||||
|
playback_ticket = stream.get('SlidePlaybackTicketId')
|
||||||
fname_template = stream['SlideImageFileNameTemplate']
|
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')
|
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)
|
fname_template = re.sub(r'\{0:D([0-9]+)\}', r'{0:0\1}', fname_template)
|
||||||
|
|
||||||
|
@ -145,7 +160,8 @@ def __extract_slides(self, *, stream_id, snum, stream, duration, images):
|
||||||
expected_type=(int, float))
|
expected_type=(int, float))
|
||||||
|
|
||||||
fragments.append({
|
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,
|
'duration': (next_time - slide['Time']) / 1000,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -191,13 +207,13 @@ def _real_extract(self, url):
|
||||||
}).encode())['d']
|
}).encode())['d']
|
||||||
|
|
||||||
presentation = player_options['Presentation']
|
presentation = player_options['Presentation']
|
||||||
title = presentation['Title']
|
|
||||||
|
|
||||||
if presentation is None:
|
if presentation is None:
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'Mediasite says: {}'.format(player_options['PlayerPresentationStatusMessage']),
|
'Mediasite says: {}'.format(player_options['PlayerPresentationStatusMessage']),
|
||||||
expected=True)
|
expected=True)
|
||||||
|
|
||||||
|
title = (presentation.get('Title')
|
||||||
|
or self._html_extract_title(webpage, 'title', fatal=False))
|
||||||
thumbnails = []
|
thumbnails = []
|
||||||
formats = []
|
formats = []
|
||||||
for snum, stream in enumerate(presentation['Streams']):
|
for snum, stream in enumerate(presentation['Streams']):
|
||||||
|
@ -233,7 +249,7 @@ def _real_extract(self, url):
|
||||||
fatal=False))
|
fatal=False))
|
||||||
elif ext in ('m3u', 'm3u8'):
|
elif ext in ('m3u', 'm3u8'):
|
||||||
stream_formats.extend(self._extract_m3u8_formats(
|
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}',
|
m3u8_id=f'{stream_id}-{snum}.{unum}',
|
||||||
fatal=False))
|
fatal=False))
|
||||||
else:
|
else:
|
||||||
|
@ -243,8 +259,9 @@ def _real_extract(self, url):
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
})
|
})
|
||||||
|
|
||||||
images = traverse_obj(player_options, ('PlayerLayoutOptions', 'Images', {dict}))
|
images = traverse_obj(
|
||||||
if stream.get('HasSlideContent') and images:
|
player_options, ('PlayerLayoutOptions', 'Images', {dict}), default={})
|
||||||
|
if stream.get('HasSlideContent'):
|
||||||
stream_formats.append(self.__extract_slides(
|
stream_formats.append(self.__extract_slides(
|
||||||
stream_id=stream_id,
|
stream_id=stream_id,
|
||||||
snum=snum,
|
snum=snum,
|
||||||
|
@ -267,6 +284,15 @@ def _real_extract(self, url):
|
||||||
})
|
})
|
||||||
formats.extend(stream_formats)
|
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['Presenters']
|
||||||
# XXX: Presentation['Transcript']
|
# XXX: Presentation['Transcript']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue