]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vidzi.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  15 class VidziIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://(?:www\.)?vidzi\.(?:tv|cc|si|nu)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)' 
  18         'url': 'http://vidzi.tv/cghql9yq6emu.html', 
  19         'md5': '4f16c71ca0c8c8635ab6932b5f3f1660', 
  23             'title': 'youtube-dl test video  1\\\\2\'3/4<5\\\\6ä7↭', 
  27             'skip_download': True, 
  30         'url': 'http://vidzi.tv/embed-4z2yb0rzphe9-600x338.html', 
  31         'only_matching': True, 
  33         'url': 'http://vidzi.cc/cghql9yq6emu.html', 
  34         'only_matching': True, 
  36         'url': 'https://vidzi.si/rph9gztxj1et.html', 
  37         'only_matching': True, 
  39         'url': 'http://vidzi.nu/cghql9yq6emu.html', 
  40         'only_matching': True, 
  43     def _real_extract(self
, url
): 
  44         video_id 
= self
._match
_id
(url
) 
  46         webpage 
= self
._download
_webpage
( 
  47             'http://vidzi.tv/%s' % video_id
, video_id
) 
  48         title 
= self
._html
_search
_regex
( 
  49             r
'(?s)<h2 class="video-title">(.*?)</h2>', webpage
, 'title') 
  53             decode_packed_codes(mobj
.group(0)).replace('\\\'', '\'') 
  54             for mobj 
in re
.finditer(PACKED_CODES_RE
, webpage
)]) 
  55         for num
, code 
in enumerate(codes
, 1): 
  56             jwplayer_data 
= self
._parse
_json
( 
  58                     r
'setup\(([^)]+)\)', code
, 'jwplayer data', 
  59                     default
=NO_DEFAULT 
if num 
== len(codes
) else '{}'), 
  60                 video_id
, transform_source
=lambda s
: js_to_json( 
  61                     re
.sub(r
'\s*\+\s*window\[.+?\]', '', s
))) 
  65         info_dict 
= self
._parse
_jwplayer
_data
(jwplayer_data
, video_id
, require_title
=False) 
  66         info_dict
['title'] = title