1
0
Fork 0

[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
commit 82d020804d
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
11 changed files with 194 additions and 173 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(