]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tonline.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..utils 
import int_or_none
 
   8 class TOnlineIE(InfoExtractor
): 
   9     IE_NAME 
= 't-online.de' 
  10     _VALID_URL 
= r
'https?://(?:www\.)?t-online\.de/tv/(?:[^/]+/)*id_(?P<id>\d+)' 
  12         'url': 'http://www.t-online.de/tv/sport/fussball/id_79166266/drittes-remis-zidane-es-muss-etwas-passieren-.html', 
  13         'md5': '7d94dbdde5f9d77c5accc73c39632c29', 
  17             'title': 'Drittes Remis! Zidane: "Es muss etwas passieren"', 
  18             'description': 'Es läuft nicht rund bei Real Madrid. Das 1:1 gegen den SD Eibar war das dritte Unentschieden in Folge in der Liga.', 
  22     def _real_extract(self
, url
): 
  23         video_id 
= self
._match
_id
(url
) 
  24         video_data 
= self
._download
_json
( 
  25             'http://www.t-online.de/tv/id_%s/tid_json_video' % video_id
, video_id
) 
  26         title 
= video_data
['subtitle'] 
  29         for asset 
in video_data
.get('assets', []): 
  30             asset_source 
= asset
.get('source') or asset
.get('source2') 
  34             for field_key 
in ('type', 'profile'): 
  35                 field_value 
= asset
.get(field_key
) 
  37                     formats_id
.append(field_value
) 
  39                 'format_id': '-'.join(formats_id
), 
  44         for image 
in video_data
.get('images', []): 
  45             image_source 
= image
.get('source') 
  55             'description': video_data
.get('description'), 
  56             'duration': int_or_none(video_data
.get('duration')), 
  57             'thumbnails': thumbnails
,