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/nexx.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'yt_dlp/extractor/nexx.py') diff --git a/yt_dlp/extractor/nexx.py b/yt_dlp/extractor/nexx.py index 01376be3d..69c48652c 100644 --- a/yt_dlp/extractor/nexx.py +++ b/yt_dlp/extractor/nexx.py @@ -114,8 +114,8 @@ class NexxIE(InfoExtractor): webpage) return mobj.group('id') if mobj else None - @staticmethod - def _extract_urls(webpage): + @classmethod + def _extract_embed_urls(cls, url, webpage): # Reference: # 1. https://nx-s.akamaized.net/files/201510/44.pdf @@ -135,10 +135,6 @@ class NexxIE(InfoExtractor): return entries - @staticmethod - def _extract_url(webpage): - return NexxIE._extract_urls(webpage)[0] - def _handle_error(self, response): if traverse_obj(response, ('metadata', 'notice'), expected_type=str): self.report_warning('%s said: %s' % (self.IE_NAME, response['metadata']['notice'])) @@ -498,6 +494,8 @@ class NexxIE(InfoExtractor): class NexxEmbedIE(InfoExtractor): _VALID_URL = r'https?://embed\.nexx(?:\.cloud|cdn\.com)/\d+/(?:video/)?(?P[^/?#&]+)' + # Reference. https://nx-s.akamaized.net/files/201510/44.pdf + _EMBED_REGEX = [r']+\bsrc=(["\'])(?P(?:https?:)?//embed\.nexx(?:\.cloud|cdn\.com)/\d+/(?:(?!\1).)+)\1'] _TESTS = [{ 'url': 'http://embed.nexx.cloud/748/KC1614647Z27Y7T?autoplay=1', 'md5': '16746bfc28c42049492385c989b26c4a', @@ -521,16 +519,6 @@ class NexxEmbedIE(InfoExtractor): 'only_matching': True, }] - @staticmethod - def _extract_urls(webpage): - # Reference: - # 1. https://nx-s.akamaized.net/files/201510/44.pdf - - # iFrame Embed Integration - return [mobj.group('url') for mobj in re.finditer( - r']+\bsrc=(["\'])(?P(?:https?:)?//embed\.nexx(?:\.cloud|cdn\.com)/\d+/(?:(?!\1).)+)\1', - webpage)] - def _real_extract(self, url): embed_id = self._match_id(url) -- cgit v1.2.3