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 webpage = io.open('922692425_http_-_m.vuclip.com_wcid=922692425_fid=70295_z=1010_nvar_frm=index.html.dump', encoding='utf-8').read()
35 r'''value="No.*?" onClick="location.href='([^"']+)'"''', webpage)
37 urlr = compat_urllib_parse_urlparse(url)
38 adfree_url = urlr.scheme + '://' + urlr.netloc + ad_m.group(1)
39 webpage = self._download_webpage(
40 adfree_url, video_id, note='Download post-ad page')
42 error_msg = self._html_search_regex(
43 r'<p class="message">(.*?)</p>', webpage, 'error message',
47 '%s said: %s' % (self.IE_NAME, error_msg), expected=True)
49 # These clowns alternate between two page types
50 links_code = self._search_regex(
53 <img\s+src="/im/play.gif".*?>|
54 <!--\ player\ end\ -->\s*</div><!--\ thumb\ end-->
58 <a\s+href="fblike'|<div\s+class="social">
60 ''', webpage, 'links')
61 title = self._html_search_regex(
62 r'<title>(.*?)-\s*Vuclip</title>', webpage, 'title').strip()
64 quality_order = qualities(['Reg', 'Hi'])
66 for url, q in re.findall(
67 r'<a\s+href="(?P<url>[^"]+)".*?>(?:<button[^>]*>)?(?P<q>[^<]+)(?:</button>)?</a>', links_code):
68 format_id = compat_urllib_parse_urlparse(url).scheme + '-' + q
70 'format_id': format_id,
72 'quality': quality_order(q),
74 self._sort_formats(formats)
76 duration = parse_duration(self._search_regex(
77 r'\(([0-9:]+)\)</span>', webpage, 'duration', fatal=False))