update handling of extractor URL patterns
When loading extractor classes during 'extractor.find(…)', their 'pattern' attribute will be replaced with a compiled version of itself.
This commit is contained in:
@@ -211,13 +211,15 @@ def get_domain(classes):
|
||||
if hasattr(cls, "root") and cls.root:
|
||||
return cls.root + "/"
|
||||
|
||||
if hasattr(cls, "test") and cls.test:
|
||||
url = cls.test[0][0]
|
||||
return url[:url.find("/", 8)+1]
|
||||
if hasattr(cls, "https"):
|
||||
scheme = "https" if cls.https else "http"
|
||||
domain = cls.__doc__.split()[-1]
|
||||
return "{}://{}/".format(scheme, domain)
|
||||
|
||||
scheme = "http" if hasattr(cls, "https") and not cls.https else "https"
|
||||
host = cls.__doc__.split()[-1]
|
||||
return scheme + "://" + host + "/"
|
||||
test = next(cls._get_tests(), None)
|
||||
if test:
|
||||
url = test[0]
|
||||
return url[:url.find("/", 8)+1]
|
||||
except (IndexError, AttributeError):
|
||||
pass
|
||||
return ""
|
||||
|
||||
@@ -6,6 +6,7 @@ import datetime
|
||||
|
||||
ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.realpath(ROOTDIR))
|
||||
|
||||
from gallery_dl import extractor, job, config
|
||||
from test.test_results import setup_test_config
|
||||
|
||||
@@ -19,7 +20,7 @@ tests = [
|
||||
if hasattr(extr, "test") and extr.test
|
||||
if len(sys.argv) <= 1 or extr.category in sys.argv
|
||||
|
||||
for idx, (url, result) in enumerate(extr.test)
|
||||
for idx, (url, result) in enumerate(extr._get_tests())
|
||||
if result
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user