2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   9     compat_urllib_parse_unquote
, 
  13 class BigflixIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?bigflix\.com/.+/(?P<id>[0-9]+)' 
  17         'url': 'http://www.bigflix.com/Tamil-movies/Drama-movies/Madarasapatinam/16070', 
  21             'title': 'Madarasapatinam', 
  22             'description': 'md5:9f0470b26a4ba8e824c823b5d95c2f6b', 
  23             'formats': 'mincount:2', 
  26             'skip_download': True, 
  30         'url': 'http://www.bigflix.com/Malayalam-movies/Drama-movies/Indian-Rupee/15967', 
  31         'only_matching': True, 
  34     def _real_extract(self
, url
): 
  35         video_id 
= self
._match
_id
(url
) 
  37         webpage 
= self
._download
_webpage
(url
, video_id
) 
  39         title 
= self
._html
_search
_regex
( 
  40             r
'<div[^>]+class=["\']pagetitle
["\'][^>]*>(.+?)</div>', 
  43         def decode_url(quoted_b64_url): 
  44             return compat_b64decode(compat_urllib_parse_unquote( 
  45                 quoted_b64_url)).decode('utf-8') 
  48         for height, encoded_url in re.findall( 
  49                 r'ContentURL_(\d{3,4})[pP][^=]+=([^&]+)', webpage): 
  50             video_url = decode_url(encoded_url) 
  53                 'format_id': '%sp' % height, 
  54                 'height': int(height), 
  56             if video_url.startswith('rtmp'): 
  60         file_url = self._search_regex( 
  61             r'file=([^&]+)', webpage, 'video url', default=None) 
  63             video_url = decode_url(file_url) 
  64             if all(f['url'] != video_url for f in formats): 
  66                     'url': decode_url(file_url), 
  69         self._sort_formats(formats) 
  71         description = self._html_search_meta('description', webpage) 
  76             'description': description,