]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/noovo.py
f7fa098a599b244315df0e1199b06087e0ccebd4
   2 from __future__ 
import unicode_literals
 
   4 from .brightcove 
import BrightcoveNewIE
 
   5 from .common 
import InfoExtractor
 
   6 from ..compat 
import compat_str
 
  14 class NoovoIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://(?:[^/]+\.)?noovo\.ca/videos/(?P<id>[^/]+/[^/?#&]+)' 
  18         'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial', 
  20             'id': '5386045029001', 
  22             'title': 'Chrysler Imperial', 
  23             'description': 'md5:de3c898d1eb810f3e6243e08c8b4a056', 
  24             'timestamp': 1491399228, 
  25             'upload_date': '20170405', 
  26             'uploader_id': '618566855001', 
  32             'skip_download': True, 
  36         'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8', 
  38             'id': '5395865725001', 
  39             'title': 'Épisode 13 : Les retrouvailles', 
  40             'description': 'md5:336d5ebc5436534e61d16e63ddfca327', 
  42             'timestamp': 1492019320, 
  43             'upload_date': '20170412', 
  44             'uploader_id': '618566855001', 
  47             'series': "L'amour est dans le pré", 
  49             'episode': 'Épisode 13', 
  53             'skip_download': True, 
  56     BRIGHTCOVE_URL_TEMPLATE 
= 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s' 
  58     def _real_extract(self
, url
): 
  59         video_id 
= self
._match
_id
(url
) 
  61         data 
= self
._download
_json
( 
  62             'http://api.noovo.ca/api/v1/pages/single-episode/%s' % video_id
, 
  65         content 
= try_get(data
, lambda x
: x
['contents'][0]) 
  67         brightcove_id 
= data
.get('brightcoveId') or content
['brightcoveId'] 
  71                 lambda x
: x
['show']['title'], 
  72                 lambda x
: x
['season']['show']['title']), 
  77         if isinstance(og
, dict) and og
.get('type') == 'video.episode': 
  78             episode 
= og
.get('title') 
  80         video 
= content 
or data
 
  83             '_type': 'url_transparent', 
  84             'ie_key': BrightcoveNewIE
.ie_key(), 
  86                 self
.BRIGHTCOVE_URL_TEMPLATE 
% brightcove_id
, 
  87                 {'geo_countries': ['CA']}), 
  89             'title': video
.get('title'), 
  90             'creator': video
.get('source'), 
  91             'view_count': int_or_none(video
.get('viewsCount')), 
  93             'season_number': int_or_none(try_get( 
  94                 data
, lambda x
: x
['season']['seasonNumber'])), 
  96             'episode_number': int_or_none(data
.get('episodeNumber')),