mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-26 08:40:12 +00:00
[lazy_extractors] Fix suitable
and add flake8 test
This commit is contained in:
@@ -458,6 +458,8 @@ class InfoExtractor(object):
|
||||
@classmethod
|
||||
def suitable(cls, url):
|
||||
"""Receives a URL and returns True if suitable for this IE."""
|
||||
# This function must import everything it needs (except other extractors),
|
||||
# so that lazy_extractors works correctly
|
||||
return cls._match_valid_url(url) is not None
|
||||
|
||||
@classmethod
|
||||
@@ -622,7 +624,7 @@ class InfoExtractor(object):
|
||||
@classmethod
|
||||
def ie_key(cls):
|
||||
"""A string for getting the InfoExtractor with get_info_extractor"""
|
||||
return compat_str(cls.__name__[:-2])
|
||||
return cls.__name__[:-2]
|
||||
|
||||
@property
|
||||
def IE_NAME(self):
|
||||
|
@@ -297,6 +297,8 @@ class RutubePlaylistIE(RutubePlaylistBaseIE):
|
||||
|
||||
@classmethod
|
||||
def suitable(cls, url):
|
||||
from ..utils import int_or_none, parse_qs
|
||||
|
||||
if not super(RutubePlaylistIE, cls).suitable(url):
|
||||
return False
|
||||
params = parse_qs(url)
|
||||
|
@@ -1837,8 +1837,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
|
||||
@classmethod
|
||||
def suitable(cls, url):
|
||||
# Hack for lazy extractors until more generic solution is implemented
|
||||
# (see #28780)
|
||||
from ..utils import parse_qs
|
||||
|
||||
qs = parse_qs(url)
|
||||
|
Reference in New Issue
Block a user