1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   7     compat_urllib_parse_urlparse
, 
  16 class VuClipIE(InfoExtractor
): 
  17     _VALID_URL 
= r
'https?://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)' 
  20         'url': 'http://m.vuclip.com/w?cid=922692425&fid=70295&z=1010&nvar&frm=index.html', 
  24             'title': 'The Toy Soldiers - Hollywood Movie Trailer', 
  29     def _real_extract(self
, url
): 
  30         video_id 
= self
._match
_id
(url
) 
  31         webpage 
= self
._download
_webpage
(url
, video_id
) 
  34             r
'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage
) 
  36             urlr 
= compat_urllib_parse_urlparse(url
) 
  37             adfree_url 
= urlr
.scheme 
+ '://' + urlr
.netloc 
+ ad_m
.group(1) 
  38             webpage 
= self
._download
_webpage
( 
  39                 adfree_url
, video_id
, note
='Download post-ad page') 
  41         error_msg 
= self
._html
_search
_regex
( 
  42             r
'<p class="message">(.*?)</p>', webpage
, 'error message', 
  46                 '%s said: %s' % (self
.IE_NAME
, error_msg
), expected
=True) 
  48         # These clowns alternate between two page types 
  49         video_url 
= self
._search
_regex
( 
  50             r
'<a[^>]+href="([^"]+)"[^>]*><img[^>]+src="[^"]*/play\.gif', 
  51             webpage
, 'video URL', default
=None) 
  57             formats 
= self
._parse
_html
5_media
_entries
(url
, webpage
)[0]['formats'] 
  59         title 
= remove_end(self
._html
_search
_regex
( 
  60             r
'<title>(.*?)-\s*Vuclip</title>', webpage
, 'title').strip(), ' - Video') 
  62         duration 
= parse_duration(self
._html
_search
_regex
( 
  63             r
'[(>]([0-9]+:[0-9]+)(?:<span|\))', webpage
, 'duration', fatal
=False))