]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nhk.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..utils 
import ExtractorError
 
   7 class NhkVodIE(InfoExtractor
): 
   8     _VALID_URL 
= r
'https?://www3\.nhk\.or\.jp/nhkworld/en/vod/(?P<id>[^/]+/[^/?#&]+)' 
  10         # Videos available only for a limited period of time. Visit 
  11         # http://www3.nhk.or.jp/nhkworld/en/vod/ for working samples. 
  12         'url': 'http://www3.nhk.or.jp/nhkworld/en/vod/tokyofashion/20160815', 
  14             'id': 'A1bnNiNTE6nY3jLllS-BIISfcC_PpvF5', 
  16             'title': 'TOKYO FASHION EXPRESS - The Kimono as Global Fashion', 
  17             'description': 'md5:db338ee6ce8204f415b754782f819824', 
  18             'series': 'TOKYO FASHION EXPRESS', 
  19             'episode': 'The Kimono as Global Fashion', 
  21         'skip': 'Videos available only for a limited period of time', 
  23     _API_URL 
= 'http://api.nhk.or.jp/nhkworld/vodesdlist/v1/all/all/all.json?apikey=EJfK8jdS57GqlupFgAfAAwr573q01y6k' 
  25     def _real_extract(self
, url
): 
  26         video_id 
= self
._match
_id
(url
) 
  28         data 
= self
._download
_json
(self
._API
_URL
, video_id
) 
  32                 e 
for e 
in data
['data']['episodes'] 
  33                 if e
.get('url') and video_id 
in e
['url']) 
  35             raise ExtractorError('Unable to find episode') 
  37         embed_code 
= episode
['vod_id'] 
  39         title 
= episode
.get('sub_title_clean') or episode
['sub_title'] 
  40         description 
= episode
.get('description_clean') or episode
.get('description') 
  41         series 
= episode
.get('title_clean') or episode
.get('title') 
  44             '_type': 'url_transparent', 
  46             'url': 'ooyala:%s' % embed_code
, 
  47             'title': '%s - %s' % (series
, title
) if series 
and title 
else title
, 
  48             'description': description
,