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