]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/noovo.py
   2 from __future__ 
import unicode_literals
 
   4 from .brightcove 
import BrightcoveNewIE
 
   5 from .common 
import InfoExtractor
 
   6 from ..compat 
import compat_str
 
  15 class NoovoIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://(?:[^/]+\.)?noovo\.ca/videos/(?P<id>[^/]+/[^/?#&]+)' 
  19         'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial', 
  21             'id': '5386045029001', 
  23             'title': 'Chrysler Imperial', 
  24             'description': 'md5:de3c898d1eb810f3e6243e08c8b4a056', 
  25             'timestamp': 1491399228, 
  26             'upload_date': '20170405', 
  27             'uploader_id': '618566855001', 
  31             'skip_download': True, 
  35         'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8', 
  37             'id': '5395865725001', 
  38             'title': 'Épisode 13 : Les retrouvailles', 
  39             'description': 'md5:888c3330f0c1b4476c5bc99a1c040473', 
  41             'timestamp': 1492019320, 
  42             'upload_date': '20170412', 
  43             'uploader_id': '618566855001', 
  44             'series': "L'amour est dans le pré", 
  46             'episode': 'Épisode 13', 
  50             'skip_download': True, 
  53     BRIGHTCOVE_URL_TEMPLATE 
= 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s' 
  55     def _real_extract(self
, url
): 
  56         video_id 
= self
._match
_id
(url
) 
  58         webpage 
= self
._download
_webpage
(url
, video_id
) 
  60         bc_url 
= BrightcoveNewIE
._extract
_url
(self
, webpage
) 
  62         data 
= self
._parse
_json
( 
  64                 r
'(?s)dataLayer\.push\(\s*({.+?})\s*\);', webpage
, 'data', 
  66             video_id
, transform_source
=js_to_json
, fatal
=False) 
  69             data
, lambda x
: x
['video']['nom'], 
  70             compat_str
) or self
._html
_search
_meta
( 
  71             'dcterms.Title', webpage
, 'title', fatal
=True) 
  73         description 
= self
._html
_search
_meta
( 
  74             ('dcterms.Description', 'description'), webpage
, 'description') 
  77             data
, lambda x
: x
['emission']['nom']) or self
._search
_regex
( 
  78             r
'<div[^>]+class="banner-card__subtitle h4"[^>]*>([^<]+)', 
  79             webpage
, 'series', default
=None) 
  81         season_el 
= try_get(data
, lambda x
: x
['emission']['saison'], dict) or {} 
  82         season 
= try_get(season_el
, lambda x
: x
['nom'], compat_str
) 
  83         season_number 
= int_or_none(try_get(season_el
, lambda x
: x
['numero'])) 
  85         episode_el 
= try_get(season_el
, lambda x
: x
['episode'], dict) or {} 
  86         episode 
= try_get(episode_el
, lambda x
: x
['nom'], compat_str
) 
  87         episode_number 
= int_or_none(try_get(episode_el
, lambda x
: x
['numero'])) 
  90             '_type': 'url_transparent', 
  91             'ie_key': BrightcoveNewIE
.ie_key(), 
  92             'url': smuggle_url(bc_url
, {'geo_countries': ['CA']}), 
  94             'description': description
, 
  97             'season_number': season_number
, 
  99             'episode_number': episode_number
,