2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class SandiaIE(InfoExtractor):
14 IE_DESC = 'Sandia National Laboratories'
15 _VALID_URL = r'https?://digitalops\.sandia\.gov/Mediasite/Play/(?P<id>[0-9a-f]+)'
17 'url': 'http://digitalops.sandia.gov/Mediasite/Play/24aace4429fc450fb5b38cdbf424a66e1d',
18 'md5': '9422edc9b9a60151727e4b6d8bef393d',
20 'id': '24aace4429fc450fb5b38cdbf424a66e1d',
22 'title': 'Xyce Software Training - Section 1',
23 'description': 're:(?s)SAND Number: SAND 2013-7800.{200,}',
24 'upload_date': '20120409',
25 'timestamp': 1333983600,
30 def _real_extract(self, url):
31 video_id = self._match_id(url)
33 presentation_data = self._download_json(
34 'http://digitalops.sandia.gov/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions',
35 video_id, data=json.dumps({
36 'getPlayerOptionsRequest': {
37 'ResourceId': video_id,
41 'Content-Type': 'application/json; charset=utf-8',
42 })['d']['Presentation']
44 title = presentation_data['Title']
47 for stream in presentation_data.get('Streams', []):
48 for fd in stream.get('VideoUrls', []):
50 'format_id': fd['MediaType'],
51 'format_note': fd['MimeType'].partition('/')[2],
52 'ext': mimetype2ext(fd['MimeType']),
53 'url': fd['Location'],
54 'protocol': 'f4m' if fd['MimeType'] == 'video/x-mp4-fragmented' else None,
56 self._sort_formats(formats)
61 'description': presentation_data.get('Description'),
63 'timestamp': int_or_none(presentation_data.get('UnixTime'), 1000),
64 'duration': int_or_none(presentation_data.get('Duration'), 1000),