]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pladform.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  13 class PladformIE(InfoExtractor
): 
  18                                 out\.pladform\.ru/player| 
  19                                 static\.pladform\.ru/player\.swf 
  22                             video\.pladform\.ru/catalog/video/videoid/ 
  27         # http://muz-tv.ru/kinozal/view/7400/ 
  28         'url': 'http://out.pladform.ru/player?pl=24822&videoid=100183293', 
  29         'md5': '61f37b575dd27f1bb2e1854777fe31f4', 
  33             'title': 'Тайны перевала Дятлова • 1 серия 2 часть', 
  34             'description': 'Документальный сериал-расследование одной из самых жутких тайн ХХ века', 
  35             'thumbnail': 're:^https?://.*\.jpg$', 
  40         'url': 'http://static.pladform.ru/player.swf?pl=21469&videoid=100183293&vkcid=0', 
  41         'only_matching': True, 
  43         'url': 'http://video.pladform.ru/catalog/video/videoid/100183293/vkcid/0', 
  44         'only_matching': True, 
  47     def _real_extract(self
, url
): 
  48         video_id 
= self
._match
_id
(url
) 
  50         video 
= self
._download
_xml
( 
  51             'http://out.pladform.ru/getVideo?pl=1&videoid=%s' % video_id
, 
  54         if video
.tag 
== 'error': 
  56                 '%s returned error: %s' % (self
.IE_NAME
, video
.text
), 
  59         quality 
= qualities(('ld', 'sd', 'hd')) 
  63             'format_id': src
.get('quality'), 
  64             'quality': quality(src
.get('quality')), 
  65         } for src 
in video
.findall('./src')] 
  66         self
._sort
_formats
(formats
) 
  68         webpage 
= self
._download
_webpage
( 
  69             'http://video.pladform.ru/catalog/video/videoid/%s' % video_id
, 
  72         title 
= self
._og
_search
_title
(webpage
, fatal
=False) or xpath_text( 
  73             video
, './/title', 'title', fatal
=True) 
  74         description 
= self
._search
_regex
( 
  75             r
'</h3>\s*<p>([^<]+)</p>', webpage
, 'description', fatal
=False) 
  76         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) or xpath_text( 
  77             video
, './/cover', 'cover') 
  79         duration 
= int_or_none(xpath_text(video
, './/time', 'duration')) 
  80         age_limit 
= int_or_none(xpath_text(video
, './/age18', 'age limit')) 
  85             'description': description
, 
  86             'thumbnail': thumbnail
, 
  88             'age_limit': age_limit
,