]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wistia.py
e6bfa9e147a2b62e6dbcdd52343675bb9ca52a65
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class WistiaIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:fast\.)?wistia\.net/embed/iframe/(?P<id>[a-z0-9]+)'
13 'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
14 'md5': 'cafeb56ec0c53c18c97405eecb3133df',
18 'title': 'Being Resourceful',
23 def _real_extract(self
, url
):
24 mobj
= re
.match(self
._VALID
_URL
, url
)
25 video_id
= mobj
.group('id')
27 webpage
= self
._download
_webpage
(url
, video_id
)
28 data_json
= self
._html
_search
_regex
(
29 r
'Wistia\.iframeInit\((.*?), {}\);', webpage
, 'video data')
31 data
= json
.loads(data_json
)
35 for atype
, a
in data
['assets'].items():
39 'resolution': '%dx%d' % (a
['width'], a
['height']),
42 if atype
== 'preview':
48 'height': a
['height'],
49 'filesize': a
['size'],
51 'preference': 1 if atype
== 'original' else None,
54 self
._sort
_formats
(formats
)
58 'title': data
['name'],
60 'thumbnails': thumbnails
,
61 'duration': data
.get('duration'),