]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fczenit.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
  11 class FczenitIE(InfoExtractor
): 
  12     _VALID_URL 
= r
'https?://(?:www\.)?fc-zenit\.ru/video/(?P<id>[0-9]+)' 
  14         'url': 'http://fc-zenit.ru/video/41044/', 
  15         'md5': '0e3fab421b455e970fa1aa3891e57df0', 
  19             'title': 'Так пишется история: казанский разгром ЦСКА на «Зенит-ТВ»', 
  20             'timestamp': 1462283735, 
  21             'upload_date': '20160503', 
  25     def _real_extract(self
, url
): 
  26         video_id 
= self
._match
_id
(url
) 
  27         webpage 
= self
._download
_webpage
(url
, video_id
) 
  29         msi_id 
= self
._search
_regex
( 
  30             r
"(?s)config\s*=\s*{.+?video_id\s*:\s*'([^']+)'", webpage
, 'msi id') 
  32         msi_data 
= self
._download
_json
( 
  33             'http://player.fc-zenit.ru/msi/video', msi_id
, query
={ 
  36         title 
= msi_data
['name'] 
  39             'format_id': q
.get('label'), 
  41             'height': int_or_none(q
.get('label')), 
  42         } for q 
in msi_data
['qualities'] if q
.get('url')] 
  44         self
._sort
_formats
(formats
) 
  46         tags 
= [tag
['label'] for tag 
in msi_data
.get('tags', []) if tag
.get('label')] 
  51             'thumbnail': msi_data
.get('preview'), 
  53             'duration': float_or_none(msi_data
.get('duration')), 
  54             'timestamp': int_or_none(msi_data
.get('date')),