]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cliphunter.py
d46592cc5c8c71d30fda96c1b25c6f4a9c55ad75
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..utils
import determine_ext
8 'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n',
9 'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r',
11 '$': ':', '&': '.', '(': '=', '^': '&', '=': '/',
16 return ''.join(_translation_table
.get(c
, c
) for c
in s
)
19 class CliphunterIE(InfoExtractor
):
20 IE_NAME
= 'cliphunter'
22 _VALID_URL
= r
'''(?x)http://(?:www\.)?cliphunter\.com/w/
24 (?P<seo>.+?)(?:$|[#\?])
27 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
28 'md5': 'b7c9bbd4eb3a226ab91093714dcaa480',
32 'title': 'Fun Jynx Maze solo',
33 'thumbnail': 're:^https?://.*\.jpg$',
38 def _real_extract(self
, url
):
39 video_id
= self
._match
_id
(url
)
40 webpage
= self
._download
_webpage
(url
, video_id
)
42 video_title
= self
._search
_regex
(
43 r
'mediaTitle = "([^"]+)"', webpage
, 'title')
46 for fmt
in ('mp4', 'flv'):
47 fmt_list
= self
._parse
_json
(self
._search
_regex
(
48 r
'var %sjson\s*=\s*(\[.*?\]);' % fmt
, webpage
, '%s formats' % fmt
), video_id
)
50 fmts
[f
['fname']] = _decode(f
['sUrl'])
52 qualities
= self
._parse
_json
(self
._search
_regex
(
53 r
'var player_btns\s*=\s*(.*?);\n', webpage
, 'quality info'), video_id
)
56 for fname
, url
in fmts
.items():
60 if fname
in qualities
:
61 qual
= qualities
[fname
]
63 'format_id': '%s_%sp' % (determine_ext(url
), qual
['h']),
70 self
._sort
_formats
(formats
)
72 thumbnail
= self
._search
_regex
(
73 r
"var\s+mov_thumb\s*=\s*'([^']+)';",
74 webpage
, 'thumbnail', fatal
=False)
80 'age_limit': self
._rta
_search
(webpage
),
81 'thumbnail': thumbnail
,