1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
10 _translation_table = {
11 'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
12 'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
14 '$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
19 return ''.join(_translation_table.get(c, c) for c in s)
22 class CliphunterIE(InfoExtractor):
23 IE_NAME = 'cliphunter'
25 _VALID_URL = r'''(?x)http://(?:www\.)?cliphunter\.com/w/
27 (?P<seo>.+?)(?:$|[#\?])
30 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
31 'md5': 'a2ba71eebf523859fe527a61018f723e',
35 'title': 'Fun Jynx Maze solo',
36 'thumbnail': 're:^https?://.*\.jpg$',
41 def _real_extract(self, url):
42 mobj = re.match(self._VALID_URL, url)
43 video_id = mobj.group('id')
45 webpage = self._download_webpage(url, video_id)
47 video_title = self._search_regex(
48 r'mediaTitle = "([^"]+)"', webpage, 'title')
50 pl_fiji = self._search_regex(
51 r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
52 pl_c_qual = self._search_regex(
53 r'pl_c_qual = "(.)"', webpage, 'video quality')
54 video_url = _decode(pl_fiji)
57 'format_id': 'default-%s' % pl_c_qual,
60 qualities_json = self._search_regex(
61 r'var pl_qualities\s*=\s*(.*?);\n', webpage, 'quality info')
62 qualities_data = json.loads(qualities_json)
64 for i, t in enumerate(
65 re.findall(r"pl_fiji_([a-z0-9]+)\s*=\s*'([^']+')", webpage)):
66 quality_id, crypted_url = t
67 video_url = _decode(crypted_url)
69 'format_id': quality_id,
73 if quality_id in qualities_data:
74 qd = qualities_data[quality_id]
76 r'''(?x)<b>(?P<width>[0-9]+)x(?P<height>[0-9]+)<\\/b>
77 \s*\(\s*(?P<tbr>[0-9]+)\s*kb\\/s''', qd)
79 f['width'] = int(m.group('width'))
80 f['height'] = int(m.group('height'))
81 f['tbr'] = int(m.group('tbr'))
83 self._sort_formats(formats)
85 thumbnail = self._search_regex(
86 r"var\s+mov_thumb\s*=\s*'([^']+)';",
87 webpage, 'thumbnail', fatal=False)
93 'age_limit': self._rta_search(webpage),
94 'thumbnail': thumbnail,