1 from __future__ import unicode_literals
5 from .common import InfoExtractor
7 compat_urllib_parse_urlparse,
14 class VuClipIE(InfoExtractor):
15 _VALID_URL = r'http://(?:m\.)?vuclip\.com/w\?.*?cid=(?P<id>[0-9]+)'
18 'url': 'http://m.vuclip.com/w?cid=922692425&fid=70295&z=1010&nvar&frm=index.html',
22 'title': 'The Toy Soldiers - Hollywood Movie Trailer',
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 error_msg = self._html_search_regex(
41 r'<p class="message">(.*?)</p>', webpage, 'error message',
45 '%s said: %s' % (self.IE_NAME, error_msg), expected=True)
47 # These clowns alternate between two page types
48 links_code = self._search_regex(
51 <img\s+src="/im/play.gif".*?>|
52 <!--\ player\ end\ -->\s*</div><!--\ thumb\ end-->
56 <a\s+href="fblike|<div\s+class="social">
58 ''', webpage, 'links')
59 title = self._html_search_regex(
60 r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip()
62 quality_order = qualities(['Reg', 'Hi'])
64 for url, q in re.findall(
65 r'<a\s+href="(?P<url>[^"]+)".*?>(?:<button[^>]*>)?(?P<q>[^<]+)(?:</button>)?</a>', links_code):
66 format_id = compat_urllib_parse_urlparse(url).scheme + '-' + q
68 'format_id': format_id,
70 'quality': quality_order(q),
72 self._sort_formats(formats)
74 duration = parse_duration(self._search_regex(
75 r'\(([0-9:]+)\)</span>', webpage, 'duration', fatal=False))