]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cliphunter.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..utils 
import int_or_none
 
   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') 
  45         gexo_files 
= self
._parse
_json
( 
  47                 r
'var\s+gexoFiles\s*=\s*({.+?});', webpage
, 'gexo files'), 
  51         for format_id
, f 
in gexo_files
.items(): 
  52             video_url 
= f
.get('url') 
  57             format_id 
= '%s_%sp' % (fmt
, height
) if fmt 
and height 
else format_id
 
  59                 'url': _decode(video_url
), 
  60                 'format_id': format_id
, 
  61                 'width': int_or_none(f
.get('w')), 
  62                 'height': int_or_none(height
), 
  63                 'tbr': int_or_none(f
.get('br')), 
  65         self
._sort
_formats
(formats
) 
  67         thumbnail 
= self
._search
_regex
( 
  68             r
"var\s+mov_thumb\s*=\s*'([^']+)';", 
  69             webpage
, 'thumbnail', fatal
=False) 
  75             'age_limit': self
._rta
_search
(webpage
), 
  76             'thumbnail': thumbnail
,