]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pladform.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  15 class PladformIE(InfoExtractor
): 
  20                                 out\.pladform\.ru/player| 
  21                                 static\.pladform\.ru/player\.swf 
  24                             video\.pladform\.ru/catalog/video/videoid/ 
  29         # http://muz-tv.ru/kinozal/view/7400/ 
  30         'url': 'http://out.pladform.ru/player?pl=24822&videoid=100183293', 
  31         'md5': '61f37b575dd27f1bb2e1854777fe31f4', 
  35             'title': 'Тайны перевала Дятлова • 1 серия 2 часть', 
  36             'description': 'Документальный сериал-расследование одной из самых жутких тайн ХХ века', 
  37             'thumbnail': 're:^https?://.*\.jpg$', 
  42         'url': 'http://static.pladform.ru/player.swf?pl=21469&videoid=100183293&vkcid=0', 
  43         'only_matching': True, 
  45         'url': 'http://video.pladform.ru/catalog/video/videoid/100183293/vkcid/0', 
  46         'only_matching': True, 
  50     def _extract_url(webpage
): 
  52             r
'<iframe[^>]+src="(?P<url>(?:https?:)?//out\.pladform\.ru/player\?.+?)"', webpage
) 
  54             return mobj
.group('url') 
  56     def _real_extract(self
, url
): 
  57         video_id 
= self
._match
_id
(url
) 
  59         video 
= self
._download
_xml
( 
  60             'http://out.pladform.ru/getVideo?pl=1&videoid=%s' % video_id
, 
  63         if video
.tag 
== 'error': 
  65                 '%s returned error: %s' % (self
.IE_NAME
, video
.text
), 
  68         quality 
= qualities(('ld', 'sd', 'hd')) 
  72             'format_id': src
.get('quality'), 
  73             'quality': quality(src
.get('quality')), 
  74         } for src 
in video
.findall('./src')] 
  75         self
._sort
_formats
(formats
) 
  77         webpage 
= self
._download
_webpage
( 
  78             'http://video.pladform.ru/catalog/video/videoid/%s' % video_id
, 
  81         title 
= self
._og
_search
_title
(webpage
, fatal
=False) or xpath_text( 
  82             video
, './/title', 'title', fatal
=True) 
  83         description 
= self
._search
_regex
( 
  84             r
'</h3>\s*<p>([^<]+)</p>', webpage
, 'description', fatal
=False) 
  85         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) or xpath_text( 
  86             video
, './/cover', 'cover') 
  88         duration 
= int_or_none(xpath_text(video
, './/time', 'duration')) 
  89         age_limit 
= int_or_none(xpath_text(video
, './/age18', 'age limit')) 
  94             'description': description
, 
  95             'thumbnail': thumbnail
, 
  97             'age_limit': age_limit
,