]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ubu.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import int_or_none
 
   9 class UbuIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'http://(?:www\.)?ubu\.com/film/(?P<id>[\da-z_-]+)\.html' 
  12         'url': 'http://ubu.com/film/her_noise.html', 
  13         'md5': '8edd46ee8aa6b265fb5ed6cf05c36bc9', 
  17             'title': 'Her Noise - The Making Of (2007)', 
  22     def _real_extract(self
, url
): 
  23         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  24         video_id 
= mobj
.group('id') 
  26         webpage 
= self
._download
_webpage
(url
, video_id
) 
  28         title 
= self
._html
_search
_regex
( 
  29             r
'<title>.+?Film & Video: ([^<]+)</title>', webpage
, 'title') 
  31         duration 
= int_or_none(self
._html
_search
_regex
( 
  32             r
'Duration: (\d+) minutes', webpage
, 'duration', fatal
=False, default
=None)) 
  39             ['sq', r
"'flashvars'\s*,\s*'file=([^']+)'"], 
  40             ['hq', r
'href="(http://ubumexico\.centro\.org\.mx/video/[^"]+)"'] 
  43         for format_id
, format_regex 
in FORMAT_REGEXES
: 
  44             m 
= re
.search(format_regex
, webpage
) 
  48                     'format_id': format_id
,