mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-09 10:50:38 +00:00
parent
0dff8e4d1e
commit
5fd8367496
@ -6,6 +6,7 @@ from ..utils import (
|
|||||||
age_restricted,
|
age_restricted,
|
||||||
bug_reports_message,
|
bug_reports_message,
|
||||||
classproperty,
|
classproperty,
|
||||||
|
variadic,
|
||||||
write_string,
|
write_string,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -475,8 +475,8 @@ class InfoExtractor:
|
|||||||
|
|
||||||
|
|
||||||
Subclasses of this should also be added to the list of extractors and
|
Subclasses of this should also be added to the list of extractors and
|
||||||
should define a _VALID_URL regexp and, re-define the _real_extract() and
|
should define _VALID_URL as a regexp or a Sequence of regexps, and
|
||||||
(optionally) _real_initialize() methods.
|
re-define the _real_extract() and (optionally) _real_initialize() methods.
|
||||||
|
|
||||||
Subclasses may also override suitable() if necessary, but ensure the function
|
Subclasses may also override suitable() if necessary, but ensure the function
|
||||||
signature is preserved and that this function imports everything it needs
|
signature is preserved and that this function imports everything it needs
|
||||||
@ -566,8 +566,8 @@ class InfoExtractor:
|
|||||||
# we have cached the regexp for *this* class, whereas getattr would also
|
# we have cached the regexp for *this* class, whereas getattr would also
|
||||||
# match the superclass
|
# match the superclass
|
||||||
if '_VALID_URL_RE' not in cls.__dict__:
|
if '_VALID_URL_RE' not in cls.__dict__:
|
||||||
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
|
cls._VALID_URL_RE = tuple(map(re.compile, variadic(cls._VALID_URL)))
|
||||||
return cls._VALID_URL_RE.match(url)
|
return next(filter(None, (regex.match(url) for regex in cls._VALID_URL_RE)), None)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user