From bfd973ece3369c593b5e82a88cc16de80088a73e Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 1 Aug 2022 06:53:25 +0530 Subject: [extractors] Use new framework for existing embeds (#4307) `Brightcove` is difficult to migrate because it's subclasses may depend on the signature of the current functions. So it is left as-is for now Note: Tests have not been migrated --- yt_dlp/extractor/nbc.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'yt_dlp/extractor/nbc.py') diff --git a/yt_dlp/extractor/nbc.py b/yt_dlp/extractor/nbc.py index 365c2e60d..910cbedf6 100644 --- a/yt_dlp/extractor/nbc.py +++ b/yt_dlp/extractor/nbc.py @@ -184,6 +184,7 @@ class NBCIE(ThePlatformIE): class NBCSportsVPlayerIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:vplayer\.nbcsports\.com|(?:www\.)?nbcsports\.com/vplayer)/' _VALID_URL = _VALID_URL_BASE + r'(?:[^/]+/)+(?P[0-9a-zA-Z_]+)' + _EMBED_REGEX = [r'(?:iframe[^>]+|var video|div[^>]+data-(?:mpx-)?)[sS]rc\s?=\s?"(?P%s[^\"]+)' % _VALID_URL_BASE] _TESTS = [{ 'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_embed/select/9CsDKds0kvHI', @@ -207,13 +208,6 @@ class NBCSportsVPlayerIE(InfoExtractor): 'only_matching': True, }] - @staticmethod - def _extract_url(webpage): - video_urls = re.search( - r'(?:iframe[^>]+|var video|div[^>]+data-(?:mpx-)?)[sS]rc\s?=\s?"(?P%s[^\"]+)' % NBCSportsVPlayerIE._VALID_URL_BASE, webpage) - if video_urls: - return video_urls.group('url') - def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) @@ -317,6 +311,7 @@ class NBCSportsStreamIE(AdobePassIE): class NBCNewsIE(ThePlatformIE): _VALID_URL = r'(?x)https?://(?:www\.)?(?:nbcnews|today|msnbc)\.com/([^/]+/)*(?:.*-)?(?P[^/?]+)' + _EMBED_REGEX = [r']+src=(["\'])(?P(?:https?:)?//www\.nbcnews\.com/widget/video-embed/[^"\']+)\1'] _TESTS = [ { -- cgit v1.2.3