1 from __future__ import unicode_literals
5 from .common import InfoExtractor
13 class CollegeRamaIE(InfoExtractor):
14 _VALID_URL = r'https?://collegerama\.tudelft\.nl/Mediasite/Play/(?P<id>[\da-f]+)'
17 'url': 'https://collegerama.tudelft.nl/Mediasite/Play/585a43626e544bdd97aeb71a0ec907a01d',
18 'md5': '481fda1c11f67588c0d9d8fbdced4e39',
20 'id': '585a43626e544bdd97aeb71a0ec907a01d',
22 'title': 'Een nieuwe wereld: waarden, bewustzijn en techniek van de mensheid 2.0.',
24 'thumbnail': 're:^https?://.*\.jpg$',
26 'timestamp': 1413309600,
27 'upload_date': '20141014',
31 'url': 'https://collegerama.tudelft.nl/Mediasite/Play/86a9ea9f53e149079fbdb4202b521ed21d?catalog=fd32fd35-6c99-466c-89d4-cd3c431bc8a4',
32 'md5': 'ef1fdded95bdf19b12c5999949419c92',
34 'id': '86a9ea9f53e149079fbdb4202b521ed21d',
36 'title': '64ste Vakantiecursus: Afvalwater',
37 'description': 'md5:7fd774865cc69d972f542b157c328305',
39 'timestamp': 1326446400,
40 'upload_date': '20120113',
45 def _real_extract(self, url):
46 video_id = self._match_id(url)
48 player_options_request = {
49 'getPlayerOptionsRequest': {
50 'ResourceId': video_id,
55 request = sanitized_Request(
56 'http://collegerama.tudelft.nl/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions',
57 json.dumps(player_options_request))
58 request.add_header('Content-Type', 'application/json')
60 player_options = self._download_json(request, video_id)
62 presentation = player_options['d']['Presentation']
63 title = presentation['Title']
64 description = presentation.get('Description')
66 duration = float_or_none(presentation.get('Duration'), 1000)
67 timestamp = int_or_none(presentation.get('UnixTime'), 1000)
70 for stream in presentation['Streams']:
71 for video in stream['VideoUrls']:
72 thumbnail_url = stream.get('ThumbnailUrl')
74 thumbnail = 'http://collegerama.tudelft.nl' + thumbnail_url
75 format_id = video['MediaType']
79 'url': video['Location'],
80 'format_id': format_id,
82 self._sort_formats(formats)
87 'description': description,
88 'thumbnail': thumbnail,
90 'timestamp': timestamp,