]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/noovo.py
1 from .brightcove
import BrightcoveNewIE
2 from .common
import InfoExtractor
3 from ..compat
import compat_str
12 class NoovoIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:[^/]+\.)?noovo\.ca/videos/(?P<id>[^/]+/[^/?#&]+)'
16 'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial',
18 'id': '5386045029001',
20 'title': 'Chrysler Imperial',
21 'description': 'md5:de3c898d1eb810f3e6243e08c8b4a056',
22 'timestamp': 1491399228,
23 'upload_date': '20170405',
24 'uploader_id': '618566855001',
28 'skip_download': True,
32 'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8',
34 'id': '5395865725001',
35 'title': 'Épisode 13 : Les retrouvailles',
36 'description': 'md5:888c3330f0c1b4476c5bc99a1c040473',
38 'timestamp': 1492019320,
39 'upload_date': '20170412',
40 'uploader_id': '618566855001',
41 'series': "L'amour est dans le pré",
43 'episode': 'Épisode 13',
47 'skip_download': True,
50 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s'
52 def _real_extract(self
, url
):
53 video_id
= self
._match
_id
(url
)
55 webpage
= self
._download
_webpage
(url
, video_id
)
57 brightcove_id
= self
._search
_regex
(
58 r
'data-video-id=["\'](\d
+)', webpage, 'brightcove
id')
60 data = self._parse_json(
62 r'(?s
)dataLayer\
.push\
(\s
*({.+?}
)\s
*\
);', webpage, 'data
',
64 video_id, transform_source=js_to_json, fatal=False)
67 data, lambda x: x['video
']['nom
'],
68 compat_str) or self._html_search_meta(
69 'dcterms
.Title
', webpage, 'title
', fatal=True)
71 description = self._html_search_meta(
72 ('dcterms
.Description
', 'description
'), webpage, 'description
')
75 data, lambda x: x['emission
']['nom
']) or self._search_regex(
76 r'<div
[^
>]+class="banner-card__subtitle h4"[^
>]*>([^
<]+)',
77 webpage, 'series
', default=None)
79 season_el = try_get(data, lambda x: x['emission
']['saison
'], dict) or {}
80 season = try_get(season_el, lambda x: x['nom
'], compat_str)
81 season_number = int_or_none(try_get(season_el, lambda x: x['numero
']))
83 episode_el = try_get(season_el, lambda x: x['episode
'], dict) or {}
84 episode = try_get(episode_el, lambda x: x['nom
'], compat_str)
85 episode_number = int_or_none(try_get(episode_el, lambda x: x['numero
']))
88 '_type
': 'url_transparent
',
89 'ie_key
': BrightcoveNewIE.ie_key(),
91 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
92 {'geo_countries': ['CA']}),
95 'description
': description,
98 'season_number
': season_number,
100 'episode_number
': episode_number,