]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vice.py
87812d6afa6db12558fbd5abd314f2046f29bdd4
   3 from .common 
import InfoExtractor
 
   4 from .ooyala 
import OoyalaIE
 
   5 from ..utils 
import ExtractorError
 
   8 class ViceIE(InfoExtractor
): 
   9     _VALID_URL 
= r
'http://www\.vice\.com/.*?/(?P<name>.+)' 
  12         u
'url': u
'http://www.vice.com/Fringes/cowboy-capitalists-part-1', 
  13         u
'file': u
'43cW1mYzpia9IlestBjVpd23Yu3afAfp.mp4', 
  15             u
'title': u
'VICE_COWBOYCAPITALISTS_PART01_v1_VICE_WM_1080p.mov', 
  18             # Requires ffmpeg (m3u8 manifest) 
  19             u
'skip_download': True, 
  23     def _real_extract(self
, url
): 
  24         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  25         name 
= mobj
.group('name') 
  26         webpage 
= self
._download
_webpage
(url
, name
) 
  28             ooyala_url 
= self
._og
_search
_video
_url
(webpage
) 
  29         except ExtractorError
: 
  31                 embed_code 
= self
._search
_regex
( 
  32                     r
'OO.Player.create\(\'ooyalaplayer
\', \'(.+?
)\'', webpage, 
  34                 ooyala_url = OoyalaIE._url_for_embed_code(embed_code) 
  35             except ExtractorError: 
  36                 raise ExtractorError(u'The page doesn
\'t contain a video
', expected=True) 
  37         return self.url_result(ooyala_url, ie='Ooyala
')