]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/collegerama.py
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': r
'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',
38 'thumbnail': r
're:^https?://.*\.jpg(?:\?.*?)?$',
40 'timestamp': 1326446400,
41 'upload_date': '20120113',
46 def _real_extract(self
, url
):
47 video_id
= self
._match
_id
(url
)
49 player_options_request
= {
50 'getPlayerOptionsRequest': {
51 'ResourceId': video_id
,
56 request
= sanitized_Request(
57 'http://collegerama.tudelft.nl/Mediasite/PlayerService/PlayerService.svc/json/GetPlayerOptions',
58 json
.dumps(player_options_request
))
59 request
.add_header('Content-Type', 'application/json')
61 player_options
= self
._download
_json
(request
, video_id
)
63 presentation
= player_options
['d']['Presentation']
64 title
= presentation
['Title']
65 description
= presentation
.get('Description')
67 duration
= float_or_none(presentation
.get('Duration'), 1000)
68 timestamp
= int_or_none(presentation
.get('UnixTime'), 1000)
71 for stream
in presentation
['Streams']:
72 for video
in stream
['VideoUrls']:
73 thumbnail_url
= stream
.get('ThumbnailUrl')
75 thumbnail
= 'http://collegerama.tudelft.nl' + thumbnail_url
76 format_id
= video
['MediaType']
80 'url': video
['Location'],
81 'format_id': format_id
,
83 self
._sort
_formats
(formats
)
88 'description': description
,
89 'thumbnail': thumbnail
,
91 'timestamp': timestamp
,