]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ubu.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  12 class UbuIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'http://(?:www\.)?ubu\.com/film/(?P<id>[\da-z_-]+)\.html' 
  15         'url': 'http://ubu.com/film/her_noise.html', 
  16         'md5': '138d5652618bf0f03878978db9bef1ee', 
  20             'title': 'Her Noise - The Making Of (2007)', 
  25     def _real_extract(self
, url
): 
  26         video_id 
= self
._match
_id
(url
) 
  27         webpage 
= self
._download
_webpage
(url
, video_id
) 
  29         title 
= self
._html
_search
_regex
( 
  30             r
'<title>.+?Film & Video: ([^<]+)</title>', webpage
, 'title') 
  32         duration 
= int_or_none(self
._html
_search
_regex
( 
  33             r
'Duration: (\d+) minutes', webpage
, 'duration', fatal
=False), 
  38             ('sq', r
"'flashvars'\s*,\s*'file=([^']+)'"), 
  39             ('hq', r
'href="(http://ubumexico\.centro\.org\.mx/video/[^"]+)"'), 
  41         preference 
= qualities([fid 
for fid
, _ 
in FORMAT_REGEXES
]) 
  42         for format_id
, format_regex 
in FORMAT_REGEXES
: 
  43             m 
= re
.search(format_regex
, webpage
) 
  47                     'format_id': format_id
, 
  48                     'preference': preference(format_id
), 
  50         self
._sort
_formats
(formats
)