]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/microsoftembed.py
1 from .common
import InfoExtractor
9 class MicrosoftEmbedIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?microsoft\.com/(?:[^/]+/)?videoplayer/embed/(?P<id>[a-z0-9A-Z]+)'
13 'url': 'https://www.microsoft.com/en-us/videoplayer/embed/RWL07e',
14 'md5': 'eb0ae9007f9b305f9acd0a03e74cb1a9',
17 'title': 'Microsoft for Public Health and Social Services',
19 'thumbnail': 'http://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RWL7Ju?ver=cae5',
21 'timestamp': 1631658316,
22 'upload_date': '20210914'
25 _API_URL
= 'https://prod-video-cms-rt-microsoft-com.akamaized.net/vhs/api/videos/'
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 metadata
= self
._download
_json
(self
._API
_URL
+ video_id
, video_id
)
32 for source_type
, source
in metadata
['streams'].items():
33 if source_type
== 'smooth_Streaming':
34 formats
.extend(self
._extract
_ism
_formats
(source
['url'], video_id
, 'mss'))
35 elif source_type
== 'apple_HTTP_Live_Streaming':
36 formats
.extend(self
._extract
_m
3u8_formats
(source
['url'], video_id
, 'mp4'))
37 elif source_type
== 'mPEG_DASH':
38 formats
.extend(self
._extract
_mpd
_formats
(source
['url'], video_id
))
41 'format_id': source_type
,
43 'height': source
.get('heightPixels'),
44 'width': source
.get('widthPixels'),
46 self
._sort
_formats
(formats
)
50 'url': data
.get('url'),
52 }] for lang
, data
in traverse_obj(metadata
, 'captions', default
={}).items()
56 'url': thumb
.get('url'),
57 'width': thumb
.get('width') or None,
58 'height': thumb
.get('height') or None,
59 } for thumb
in traverse_obj(metadata
, ('snippet', 'thumbnails', ...))]
60 self
._remove
_duplicate
_formats
(thumbnails
)
64 'title': traverse_obj(metadata
, ('snippet', 'title')),
65 'timestamp': unified_timestamp(traverse_obj(metadata
, ('snippet', 'activeStartDate'))),
66 'age_limit': int_or_none(traverse_obj(metadata
, ('snippet', 'minimumAge'))) or 0,
68 'subtitles': subtitles
,
69 'thumbnails': thumbnails
,