]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wistia.py
   4 from .common 
import InfoExtractor
 
   7 class WistiaIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'^https?://(?:fast\.)?wistia\.net/embed/iframe/(?P<id>[a-z0-9]+)' 
  11         u
"url": u
"http://fast.wistia.net/embed/iframe/sh7fpupwlt", 
  12         u
"file": u
"sh7fpupwlt.mov", 
  13         u
"md5": u
"cafeb56ec0c53c18c97405eecb3133df", 
  15             u
"title": u
"cfh_resourceful_zdkh_final_1" 
  19     def _real_extract(self
, url
): 
  20         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  21         video_id 
= mobj
.group('id') 
  23         webpage 
= self
._download
_webpage
(url
, video_id
) 
  24         data_json 
= self
._html
_search
_regex
( 
  25             r
'Wistia.iframeInit\((.*?), {}\);', webpage
, u
'video data') 
  27         data 
= json
.loads(data_json
) 
  31         for atype
, a 
in data
['assets'].items(): 
  35                     'resolution': '%dx%d' % (a
['width'], a
['height']), 
  38             if atype 
== 'preview': 
  44                 'height': a
['height'], 
  45                 'filesize': a
['size'], 
  47                 'preference': 1 if atype 
== 'original' else None, 
  50         self
._sort
_formats
(formats
) 
  54             'title': data
['name'], 
  56             'thumbnails': thumbnails
,