]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/yandexvideo.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  12 class YandexVideoIE(InfoExtractor
): 
  16                             yandex\.ru(?:/portal/(?:video|efir))?/?\?.*?stream_id=| 
  17                             frontend\.vh\.yandex\.ru/player/ 
  22         'url': 'https://yandex.ru/portal/video?stream_id=4dbb262b4fe5cf15a215de4f34eee34d', 
  23         'md5': '33955d7ae052f15853dc41f35f17581c', 
  25             'id': '4dbb262b4fe5cf15a215de4f34eee34d', 
  27             'title': 'В Нью-Йорке баржи и теплоход оторвались от причала и расплылись по Гудзону', 
  29             'thumbnail': r
're:^https?://.*\.jpg$', 
  35         'url': 'https://yandex.ru/portal/efir?stream_id=4dbb36ec4e0526d58f9f2dc8f0ecf374&from=morda', 
  36         'only_matching': True, 
  38         'url': 'https://yandex.ru/?stream_id=4dbb262b4fe5cf15a215de4f34eee34d', 
  39         'only_matching': True, 
  41         'url': 'https://frontend.vh.yandex.ru/player/4dbb262b4fe5cf15a215de4f34eee34d?from=morda', 
  42         'only_matching': True, 
  44         # vod-episode, series episode 
  45         'url': 'https://yandex.ru/portal/video?stream_id=45b11db6e4b68797919c93751a938cee', 
  46         'only_matching': True, 
  49         'url': 'https://yandex.ru/?stream_channel=1538487871&stream_id=4132a07f71fb0396be93d74b3477131d', 
  50         'only_matching': True, 
  53         'url': 'https://yandex.ru/portal/video?from=morda&stream_id=485a92d94518d73a9d0ff778e13505f8', 
  54         'only_matching': True, 
  57     def _real_extract(self
, url
): 
  58         video_id 
= self
._match
_id
(url
) 
  60         content 
= self
._download
_json
( 
  61             'https://frontend.vh.yandex.ru/v22/player/%s.json' % video_id
, 
  63                 'stream_options': 'hires', 
  64                 'disable_trackings': 1, 
  67         content_url 
= url_or_none(content
.get('content_url')) or url_or_none( 
  68             content
['streams'][0]['url']) 
  69         title 
= content
.get('title') or content
.get('computed_title') 
  71         ext 
= determine_ext(content_url
) 
  74             formats 
= self
._extract
_m
3u8_formats
( 
  75                 content_url
, video_id
, 'mp4', entry_protocol
='m3u8_native', 
  78             formats 
= self
._extract
_mpd
_formats
( 
  79                 content_url
, video_id
, mpd_id
='dash') 
  81             formats 
= [{'url': content_url
}] 
  83         self
._sort
_formats
(formats
) 
  85         description 
= content
.get('description') 
  86         thumbnail 
= content
.get('thumbnail') 
  87         timestamp 
= (int_or_none(content
.get('release_date')) 
  88                      or int_or_none(content
.get('release_date_ut')) 
  89                      or int_or_none(content
.get('start_time'))) 
  90         duration 
= int_or_none(content
.get('duration')) 
  91         series 
= content
.get('program_title') 
  92         age_limit 
= int_or_none(content
.get('restriction_age')) 
  97             'description': description
, 
  98             'thumbnail': thumbnail
, 
  99             'timestamp': timestamp
, 
 100             'duration': duration
, 
 102             'age_limit': age_limit
,