1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   7     compat_urllib_parse_urlparse
, 
  13 class VuClipIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'http://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)' 
  17         'url': 'http://m.vuclip.com/w?cid=843902317&fid=63532&z=1007&nvar&frm=index.html&bu=4757321434', 
  18         'md5': '92ac9d1ccefec4f0bb474661ab144fcf', 
  22             'title': 'Movie Trailer: Noah', 
  27     def _real_extract(self
, url
): 
  28         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  29         video_id 
= mobj
.group('id') 
  31         webpage 
= self
._download
_webpage
(url
, video_id
) 
  33             r
'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage
) 
  35             urlr 
= compat_urllib_parse_urlparse(url
) 
  36             adfree_url 
= urlr
.scheme 
+ '://' + urlr
.netloc 
+ ad_m
.group(1) 
  37             webpage 
= self
._download
_webpage
( 
  38                 adfree_url
, video_id
, note
='Download post-ad page') 
  40         links_code 
= self
._search
_regex
( 
  41             r
'(?s)<div class="social align_c".*?>(.*?)<hr\s*/?>', webpage
, 
  43         title 
= self
._html
_search
_regex
( 
  44             r
'<title>(.*?)-\s*Vuclip</title>', webpage
, 'title').strip() 
  46         quality_order 
= qualities(['Reg', 'Hi']) 
  48         for url
, q 
in re
.findall( 
  49                 r
'<a href="(?P<url>[^"]+)".*?>(?P<q>[^<]+)</a>', links_code
): 
  50             format_id 
= compat_urllib_parse_urlparse(url
).scheme 
+ '-' + q
 
  52                 'format_id': format_id
, 
  54                 'quality': quality_order(q
), 
  56         self
._sort
_formats
(formats
) 
  58         duration 
= parse_duration(self
._search
_regex
( 
  59             r
'\(([0-9:]+)\)</span></h1>', webpage
, 'duration', fatal
=False))