]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pladform.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..compat 
import compat_urlparse
 
  17 class PladformIE(InfoExtractor
): 
  22                                 out\.pladform\.ru/player| 
  23                                 static\.pladform\.ru/player\.swf 
  26                             video\.pladform\.ru/catalog/video/videoid/ 
  31         'url': 'https://out.pladform.ru/player?pl=64471&videoid=3777899&vk_puid15=0&vk_puid34=0', 
  32         'md5': '53362fac3a27352da20fa2803cc5cd6f', 
  36             'title': 'СТУДИЯ СОЮЗ • Шоу Студия Союз, 24 выпуск (01.02.2018) Нурлан Сабуров и Слава Комиссаренко', 
  37             'description': 'md5:05140e8bf1b7e2d46e7ba140be57fd95', 
  38             'thumbnail': r
'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
\?.+?
)\
1', webpage) 
  54             return mobj.group('url
') 
  56     def _real_extract(self, url): 
  57         video_id = self._match_id(url) 
  59         qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query) 
  60         pl = qs.get('pl
', ['1'])[0] 
  62         video = self._download_xml( 
  63             'http
://out
.pladform
.ru
/getVideo
', video_id, query={ 
  70                 '%s returned error
: %s' % (self.IE_NAME, text), 
  73         if video.tag == 'error
': 
  76         quality = qualities(('ld
', 'sd
', 'hd
')) 
  79         for src in video.findall('./src
'): 
  85             if src.get('type') == 'hls
' or determine_ext(format_url) == 'm3u8
': 
  86                 formats.extend(self._extract_m3u8_formats( 
  87                     format_url, video_id, 'mp4
', entry_protocol='m3u8_native
', 
  88                     m3u8_id='hls
', fatal=False)) 
  92                     'format_id
': src.get('quality
'), 
  93                     'quality
': quality(src.get('quality
')), 
  97             error = xpath_text(video, './cap
', 'error
', default=None) 
 101         self._sort_formats(formats) 
 103         webpage = self._download_webpage( 
 104             'http
://video
.pladform
.ru
/catalog
/video
/videoid
/%s' % video_id, 
 107         title = self._og_search_title(webpage, fatal=False) or xpath_text( 
 108             video, './/title
', 'title
', fatal=True) 
 109         description = self._search_regex( 
 110             r'</h3
>\s
*<p
>([^
<]+)</p
>', webpage, 'description
', fatal=False) 
 111         thumbnail = self._og_search_thumbnail(webpage) or xpath_text( 
 112             video, './/cover
', 'cover
') 
 114         duration = int_or_none(xpath_text(video, './/time
', 'duration
')) 
 115         age_limit = int_or_none(xpath_text(video, './/age18
', 'age limit
')) 
 120             'description
': description, 
 121             'thumbnail
': thumbnail, 
 122             'duration
': duration, 
 123             'age_limit
': age_limit,