From fcaf3329e215af9197329f5db5f2e8b271a0d995 Mon Sep 17 00:00:00 2001 From: Frederic Bournival Date: Wed, 19 Apr 2017 17:43:32 -0400 Subject: [PATCH 1/4] [Noovo] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/noovo.py | 57 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 youtube_dl/extractor/noovo.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index a92cbefed..7f84c86f9 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -663,6 +663,7 @@ from .nintendo import NintendoIE from .njpwworld import NJPWWorldIE from .nobelprize import NobelPrizeIE from .noco import NocoIE +from .noovo import NoovoIE from .normalboots import NormalbootsIE from .nosvideo import NosVideoIE from .nova import NovaIE diff --git a/youtube_dl/extractor/noovo.py b/youtube_dl/extractor/noovo.py new file mode 100644 index 000000000..fb248312b --- /dev/null +++ b/youtube_dl/extractor/noovo.py @@ -0,0 +1,57 @@ +# coding: utf-8 +from __future__ import unicode_literals +from .common import InfoExtractor +from ..utils import ExtractorError + + +class NoovoIE(InfoExtractor): + + _VALID_URL = r'https?://(?:[a-z0-9\-]+\.)?noovo\.ca/videos/(?P[a-z0-9\-]+/[a-z0-9\-]+)' + + _TESTS = [{ + 'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial', + 'md5': '2fcc04d0a8f4a853fad91233c2fdd121', + 'info_dict': { + 'id': '5386045029001', + 'description': 'Antoine présente des véhicules qu\'il aperçoit sur la rue.', + 'ext': 'mp4', + 'timestamp': 1491399228, + 'title': 'Chrysler Imperial', + 'upload_date': '20170405', + 'uploader_id': '618566855001' + } + }, { + 'url': 'http://interventions.noovo.ca/911/video/intoxication-aux-drogues-dures/?autoplay=1', + 'md5': '0ca96cef6d6b3a3a4836a05936964da4', + 'info_dict': { + 'id': '5397570276001', + 'description': 'md5:573bb7da6ffbfa310e2ebab88688e5ad', + 'ext': 'mp4', + 'timestamp': 1492112546, + 'title': 'md5:5015fe58f797e58abdda1c6711530405', + 'upload_date': '20170413', + 'uploader_id': '618566855001' + } + }] + + TEMPLATE_API_URL = 'http://api.noovo.ca/api/v1/pages/single-episode/%s' + + BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s' + + def _real_extract(self, url): + video_id = self._match_id(url) + + api_url = self.TEMPLATE_API_URL % video_id + + api_content = self._download_webpage(api_url, video_id) + + brightcove_id = self._search_regex( + r'"?brightcoveId"?\s*:\s*"?(\d+)', api_content, 'brightcove id' + ) + + if brightcove_id: + return self.url_result( + self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id + ) + else: + raise ExtractorError('Unable to extract brightcove id from api') From cd3a2f26c2efa221edabffc0f46c8e74e7a5ff6f Mon Sep 17 00:00:00 2001 From: Frederic Bournival Date: Wed, 19 Apr 2017 21:34:04 -0400 Subject: [PATCH 2/4] [Noovo] Add new extractor --- youtube_dl/extractor/noovo.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/noovo.py b/youtube_dl/extractor/noovo.py index fb248312b..415b112bb 100644 --- a/youtube_dl/extractor/noovo.py +++ b/youtube_dl/extractor/noovo.py @@ -32,6 +32,18 @@ class NoovoIE(InfoExtractor): 'upload_date': '20170413', 'uploader_id': '618566855001' } + }, { + 'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8', + 'md5': '1199e96fbb93f2d42717115f72097b6b', + 'info_dict': { + 'id': '5395865725001', + 'description': 'md5:336d5ebc5436534e61d16e63ddfca327', + 'ext': 'mp4', + 'timestamp': 1492019320, + 'title': 'md5:2895fdc124639be0ef64ea0d06f5e493', + 'upload_date': '20170412', + 'uploader_id': '618566855001' + } }] TEMPLATE_API_URL = 'http://api.noovo.ca/api/v1/pages/single-episode/%s' @@ -43,11 +55,12 @@ class NoovoIE(InfoExtractor): api_url = self.TEMPLATE_API_URL % video_id - api_content = self._download_webpage(api_url, video_id) + api_content = self._download_json(api_url, video_id) - brightcove_id = self._search_regex( - r'"?brightcoveId"?\s*:\s*"?(\d+)', api_content, 'brightcove id' - ) + brightcove_id = api_content.get('data').get('brightcoveId') + + if not brightcove_id: + brightcove_id = api_content.get('data').get('contents')[0].get('brightcoveId') if brightcove_id: return self.url_result( From 8c0d3a4792da79488830ea591345f010a94002b2 Mon Sep 17 00:00:00 2001 From: Frederic Bournival Date: Wed, 19 Apr 2017 21:37:28 -0400 Subject: [PATCH 3/4] [Noovo] Add new extractor --- youtube_dl/extractor/noovo.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/noovo.py b/youtube_dl/extractor/noovo.py index 415b112bb..25a5ded1a 100644 --- a/youtube_dl/extractor/noovo.py +++ b/youtube_dl/extractor/noovo.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import ExtractorError class NoovoIE(InfoExtractor): @@ -62,9 +61,6 @@ class NoovoIE(InfoExtractor): if not brightcove_id: brightcove_id = api_content.get('data').get('contents')[0].get('brightcoveId') - if brightcove_id: - return self.url_result( - self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id - ) - else: - raise ExtractorError('Unable to extract brightcove id from api') + return self.url_result( + self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'BrightcoveNew', brightcove_id + ) From c1612e238280f593771c4d8163792c8b0457a9ed Mon Sep 17 00:00:00 2001 From: Frederic Bournival Date: Tue, 25 Apr 2017 22:02:04 -0400 Subject: [PATCH 4/4] Noovo Add new extractor --- youtube_dl/extractor/noovo.py | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/youtube_dl/extractor/noovo.py b/youtube_dl/extractor/noovo.py index 25a5ded1a..9f441c2fc 100644 --- a/youtube_dl/extractor/noovo.py +++ b/youtube_dl/extractor/noovo.py @@ -4,9 +4,9 @@ from .common import InfoExtractor class NoovoIE(InfoExtractor): - - _VALID_URL = r'https?://(?:[a-z0-9\-]+\.)?noovo\.ca/videos/(?P[a-z0-9\-]+/[a-z0-9\-]+)' - + IE_NAME = 'Noovo' + IE_DESC = 'VTele, Max, MusiquePlus' + _VALID_URL = r'https?://(?:[a-z0-9-]+\.)?noovo\.ca/videos/(?P[a-z0-9-]+/[a-z0-9-]+)' _TESTS = [{ 'url': 'http://noovo.ca/videos/rpm-plus/chrysler-imperial', 'md5': '2fcc04d0a8f4a853fad91233c2fdd121', @@ -19,18 +19,6 @@ class NoovoIE(InfoExtractor): 'upload_date': '20170405', 'uploader_id': '618566855001' } - }, { - 'url': 'http://interventions.noovo.ca/911/video/intoxication-aux-drogues-dures/?autoplay=1', - 'md5': '0ca96cef6d6b3a3a4836a05936964da4', - 'info_dict': { - 'id': '5397570276001', - 'description': 'md5:573bb7da6ffbfa310e2ebab88688e5ad', - 'ext': 'mp4', - 'timestamp': 1492112546, - 'title': 'md5:5015fe58f797e58abdda1c6711530405', - 'upload_date': '20170413', - 'uploader_id': '618566855001' - } }, { 'url': 'http://noovo.ca/videos/l-amour-est-dans-le-pre/episode-13-8', 'md5': '1199e96fbb93f2d42717115f72097b6b', @@ -43,21 +31,19 @@ class NoovoIE(InfoExtractor): 'upload_date': '20170412', 'uploader_id': '618566855001' } + }, { + 'url': 'http://interventions.noovo.ca/911/video/intoxication-aux-drogues-dures/?autoplay=1', + 'only_matching': True }] - - TEMPLATE_API_URL = 'http://api.noovo.ca/api/v1/pages/single-episode/%s' - + API_URL_TEMPLATE = 'http://api.noovo.ca/api/v1/pages/single-episode/%s' BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/618566855001/default_default/index.html?videoId=%s' def _real_extract(self, url): video_id = self._match_id(url) - - api_url = self.TEMPLATE_API_URL % video_id - + api_url = self.API_URL_TEMPLATE % video_id api_content = self._download_json(api_url, video_id) brightcove_id = api_content.get('data').get('brightcoveId') - if not brightcove_id: brightcove_id = api_content.get('data').get('contents')[0].get('brightcoveId')