]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/krasview.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class KrasViewIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://krasview\.ru/(?:video|embed)/(?P<id>\d+)' 
  18         'url': 'http://krasview.ru/video/512228', 
  19         'md5': '3b91003cf85fc5db277870c8ebd98eae', 
  23             'title': 'Снег, лёд, заносы', 
  24             'description': 'Снято в городе Нягань, в Ханты-Мансийском автономном округе.', 
  26             'thumbnail': 're:^https?://.*\.jpg', 
  29             'skip_download': 'Not accessible from Travis CI server', 
  33     def _real_extract(self
, url
): 
  34         video_id 
= self
._match
_id
(url
) 
  36         webpage 
= self
._download
_webpage
(url
, video_id
) 
  38         flashvars 
= json
.loads(js_to_json(self
._search
_regex
( 
  39             r
'video_Init\(({.+?})', webpage
, 'flashvars'))) 
  41         video_url 
= flashvars
['url'] 
  42         title 
= self
._og
_search
_title
(webpage
) 
  43         description 
= self
._og
_search
_description
(webpage
, default
=None) 
  44         thumbnail 
= flashvars
.get('image') or self
._og
_search
_thumbnail
(webpage
) 
  45         duration 
= int_or_none(flashvars
.get('duration')) 
  46         width 
= int_or_none(self
._og
_search
_property
( 
  47             'video:width', webpage
, 'video width', default
=None)) 
  48         height 
= int_or_none(self
._og
_search
_property
( 
  49             'video:height', webpage
, 'video height', default
=None)) 
  55             'description': description
, 
  56             'thumbnail': thumbnail
,