1 from .brightcove
import BrightcoveNewIE
2 from .common
import InfoExtractor
11 class NoovoIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:[^/]+\.)?noovo\.ca/videos/(?P<id>[^/]+/[^/?#&]+)'
15 'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial',
17 'id': '5386045029001',
19 'title': 'Chrysler Imperial',
20 'description': 'md5:de3c898d1eb810f3e6243e08c8b4a056',
21 'timestamp': 1491399228,
22 'upload_date': '20170405',
23 'uploader_id': '618566855001',
27 'skip_download': True,
31 'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8',
33 'id': '5395865725001',
34 'title': 'Épisode 13 : Les retrouvailles',
35 'description': 'md5:888c3330f0c1b4476c5bc99a1c040473',
37 'timestamp': 1492019320,
38 'upload_date': '20170412',
39 'uploader_id': '618566855001',
40 'series': "L'amour est dans le pré",
42 'episode': 'Épisode 13',
46 'skip_download': True,
49 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s'
51 def _real_extract(self
, url
):
52 video_id
= self
._match
_id
(url
)
54 webpage
= self
._download
_webpage
(url
, video_id
)
56 brightcove_id
= self
._search
_regex
(
57 r
'data-video-id=["\'](\d
+)', webpage, 'brightcove
id')
59 data = self._parse_json(
61 r'(?s
)dataLayer\
.push\
(\s
*({.+?
})\s
*\
);', webpage, 'data
',
63 video_id, transform_source=js_to_json, fatal=False)
66 data, lambda x: x['video
']['nom
'],
67 str) or self._html_search_meta(
68 'dcterms
.Title
', webpage, 'title
', fatal=True)
70 description = self._html_search_meta(
71 ('dcterms
.Description
', 'description
'), webpage, 'description
')
74 data, lambda x: x['emission
']['nom
']) or self._search_regex(
75 r'<div
[^
>]+class="banner-card__subtitle h4"[^
>]*>([^
<]+)',
76 webpage, 'series
', default=None)
78 season_el = try_get(data, lambda x: x['emission
']['saison
'], dict) or {}
79 season = try_get(season_el, lambda x: x['nom
'], str)
80 season_number = int_or_none(try_get(season_el, lambda x: x['numero
']))
82 episode_el = try_get(season_el, lambda x: x['episode
'], dict) or {}
83 episode = try_get(episode_el, lambda x: x['nom
'], str)
84 episode_number = int_or_none(try_get(episode_el, lambda x: x['numero
']))
87 '_type
': 'url_transparent
',
88 'ie_key
': BrightcoveNewIE.ie_key(),
90 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
91 {'geo_countries
': ['CA
']}),
94 'description
': description,
97 'season_number
': season_number,
99 'episode_number
': episode_number,