1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-01 07:05:14 +00:00

[extractor] Use classmethod/property where possible

and refactor lazy extractors accordingly.

This reduces the need to create extractor instances
This commit is contained in:
pukkandan
2022-05-11 21:24:44 +05:30
parent 7ddbf09c25
commit 82d020804d
11 changed files with 188 additions and 167 deletions

View File

@@ -31,6 +31,7 @@ from ..utils import (
NO_DEFAULT,
ExtractorError,
bug_reports_message,
classproperty,
clean_html,
datetime_from_str,
dict_get,
@@ -5781,16 +5782,17 @@ class YoutubeMusicSearchURLIE(YoutubeTabBaseInfoExtractor):
class YoutubeFeedsInfoExtractor(InfoExtractor):
"""
Base class for feed extractors
Subclasses must define the _FEED_NAME property.
Subclasses must re-define the _FEED_NAME property.
"""
_LOGIN_REQUIRED = True
_FEED_NAME = 'feeds'
def _real_initialize(self):
YoutubeBaseInfoExtractor._check_login_required(self)
@property
@classproperty
def IE_NAME(self):
return 'youtube:%s' % self._FEED_NAME
return f'youtube:{self._FEED_NAME}'
def _real_extract(self, url):
return self.url_result(