]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wistia.py
fdb16d91c25ae4a3d3c8314a76050d09cf86ef3a
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class WistiaIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:fast\.)?wistia\.net/embed/iframe/(?P<id>[a-z0-9]+)'
12 _API_URL
= 'http://fast.wistia.com/embed/medias/{0:}.json'
15 'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
16 'md5': 'cafeb56ec0c53c18c97405eecb3133df',
20 'title': 'Being Resourceful',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
28 request
= sanitized_Request(self
._API
_URL
.format(video_id
))
29 request
.add_header('Referer', url
) # Some videos require this.
30 data_json
= self
._download
_json
(request
, video_id
)
31 if data_json
.get('error'):
32 raise ExtractorError('Error while getting the playlist',
34 data
= data_json
['media']
38 for atype
, a
in data
['assets'].items():
42 'resolution': '%dx%d' % (a
['width'], a
['height']),
45 if atype
== 'preview':
51 'height': a
['height'],
52 'filesize': a
['size'],
54 'preference': 1 if atype
== 'original' else None,
57 self
._sort
_formats
(formats
)
61 'title': data
['name'],
63 'thumbnails': thumbnails
,
64 'duration': data
.get('duration'),