2 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..compat import compat_urllib_parse_unquote
11 class BigflixIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?bigflix\.com/.+/(?P<id>[0-9]+)'
14 'url': 'http://www.bigflix.com/Hindi-movies/Action-movies/Singham-Returns/16537',
15 'md5': 'ec76aa9b1129e2e5b301a474e54fab74',
19 'title': 'Singham Returns',
20 'description': 'md5:3d2ba5815f14911d5cc6a501ae0cf65d',
24 'url': 'http://www.bigflix.com/Tamil-movies/Drama-movies/Madarasapatinam/16070',
28 'title': 'Madarasapatinam',
29 'description': 'md5:63b9b8ed79189c6f0418c26d9a3452ca',
30 'formats': 'mincount:2',
33 'skip_download': True,
37 'url': 'http://www.bigflix.com/Malayalam-movies/Drama-movies/Indian-Rupee/15967',
38 'only_matching': True,
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
44 webpage = self._download_webpage(url, video_id)
46 title = self._html_search_regex(
47 r'<div[^>]+class=["\']pagetitle["\'][^>]*>(.+?)</div>',
50 def decode_url(quoted_b64_url):
51 return base64.b64decode(compat_urllib_parse_unquote(
52 quoted_b64_url).encode('ascii')).decode('utf-8')
55 for height, encoded_url in re.findall(
56 r'ContentURL_(\d{3,4})[pP][^=]+=([^&]+)', webpage):
57 video_url = decode_url(encoded_url)
60 'format_id': '%sp' % height,
61 'height': int(height),
63 if video_url.startswith('rtmp'):
67 file_url = self._search_regex(
68 r'file=([^&]+)', webpage, 'video url', default=None)
70 video_url = decode_url(file_url)
71 if all(f['url'] != video_url for f in formats):
73 'url': decode_url(file_url),
76 self._sort_formats(formats)
78 description = self._html_search_meta('description', webpage)
83 'description': description,