]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cliphunter.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
10 'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
11 'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
13 '$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
18 return ''.join(_translation_table
.get(c
, c
) for c
in s
)
21 class CliphunterIE(InfoExtractor
):
22 IE_NAME
= 'cliphunter'
24 _VALID_URL
= r
'''(?x)http://(?:www\.)?cliphunter\.com/w/
26 (?P<seo>.+?)(?:$|[#\?])
29 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
30 'md5': 'a2ba71eebf523859fe527a61018f723e',
34 'title': 'Fun Jynx Maze solo',
35 'thumbnail': 're:^https?://.*\.jpg$',
40 def _real_extract(self
, url
):
41 video_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(url
, video_id
)
44 video_title
= self
._search
_regex
(
45 r
'mediaTitle = "([^"]+)"', webpage
, 'title')
47 pl_fiji
= self
._search
_regex
(
48 r
'pl_fiji = \'([^
\']+)\'', webpage, 'video data
')
49 pl_c_qual = self._search_regex(
50 r'pl_c_qual
= "(.)"', webpage, 'video quality
')
51 video_url = _decode(pl_fiji)
54 'format_id
': 'default
-%s' % pl_c_qual,
57 qualities_json = self._search_regex(
58 r'var pl_qualities\s
*=\s
*(.*?
);\n', webpage, 'quality info
')
59 qualities_data = json.loads(qualities_json)
61 for i, t in enumerate(
62 re.findall(r"pl_fiji_([a-z0-9]+)\s*=\s*'([^
']+')", webpage)):
63 quality_id, crypted_url = t
64 video_url = _decode(crypted_url)
66 'format_id': quality_id,
70 if quality_id in qualities_data:
71 qd = qualities_data[quality_id]
73 r'''(?x)<b>(?P<width>[0-9]+)x(?P<height>[0-9]+)<\\/b>
74 \s*\(\s*(?P<tbr>[0-9]+)\s*kb\\/s''', qd)
76 f['width'] = int(m.group('width'))
77 f['height'] = int(m.group('height'))
78 f['tbr'] = int(m.group('tbr'))
80 self._sort_formats(formats)
82 thumbnail = self._search_regex(
83 r"var\s
+mov_thumb\s
*=\s
*'([^']+)';",
84 webpage, 'thumbnail
', fatal=False)
90 'age_limit
': self._rta_search(webpage),
91 'thumbnail
': thumbnail,