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/peertube.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'yt_dlp/extractor/peertube.py') diff --git a/yt_dlp/extractor/peertube.py b/yt_dlp/extractor/peertube.py index 0d3bc18a8..6d280e41c 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -1057,6 +1057,7 @@ class PeerTubeIE(InfoExtractor): ) (?P%s) ''' % (_INSTANCES_RE, _UUID_RE) + _EMBED_REGEX = [r'''(?x)]+\bsrc=["\'](?P(?:https?:)?//{_INSTANCES_RE}/videos/embed/{cls._UUID_RE})'''] _TESTS = [{ 'url': 'https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d', 'md5': '8563064d245a4be5705bddb22bb00a28', @@ -1158,16 +1159,15 @@ class PeerTubeIE(InfoExtractor): '>We are sorry but it seems that PeerTube is not compatible with your web browser.<')): return 'peertube:%s:%s' % mobj.group('host', 'id') - @staticmethod - def _extract_urls(webpage, source_url): - entries = re.findall( - r'''(?x)]+\bsrc=["\'](?P(?:https?:)?//%s/videos/embed/%s)''' - % (PeerTubeIE._INSTANCES_RE, PeerTubeIE._UUID_RE), webpage) - if not entries: - peertube_url = PeerTubeIE._extract_peertube_url(webpage, source_url) - if peertube_url: - entries = [peertube_url] - return entries + @classmethod + def _extract_embed_urls(cls, url, webpage): + embeds = tuple(super()._extract_embed_urls(url, webpage)) + if embeds: + return embeds + + peertube_url = cls._extract_peertube_url(webpage, url) + if peertube_url: + return [peertube_url] def _call_api(self, host, video_id, path, note=None, errnote=None, fatal=True): return self._download_json( -- cgit v1.2.3 From 9f14daf22b4080ae1531a772ee7574959af4e2fa Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 17 Nov 2022 10:40:03 +0530 Subject: [extractor] Deprecate `_sort_formats` --- yt_dlp/extractor/peertube.py | 1 - 1 file changed, 1 deletion(-) (limited to 'yt_dlp/extractor/peertube.py') diff --git a/yt_dlp/extractor/peertube.py b/yt_dlp/extractor/peertube.py index 6d280e41c..68e15737b 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -1233,7 +1233,6 @@ class PeerTubeIE(InfoExtractor): else: f['fps'] = int_or_none(file_.get('fps')) formats.append(f) - self._sort_formats(formats) description = video.get('description') if description and len(description) >= 250: -- cgit v1.2.3