update scripts/supportedsites.py
This commit is contained in:
@@ -14,6 +14,11 @@ import collections
|
|||||||
import util
|
import util
|
||||||
from gallery_dl import extractor
|
from gallery_dl import extractor
|
||||||
|
|
||||||
|
try:
|
||||||
|
from test import results
|
||||||
|
except ImportError:
|
||||||
|
results = None
|
||||||
|
|
||||||
|
|
||||||
CATEGORY_MAP = {
|
CATEGORY_MAP = {
|
||||||
"2chan" : "Futaba Channel",
|
"2chan" : "Futaba Channel",
|
||||||
@@ -367,17 +372,8 @@ def domain(cls):
|
|||||||
if hasattr(cls, "root") and cls.root:
|
if hasattr(cls, "root") and cls.root:
|
||||||
return cls.root + "/"
|
return cls.root + "/"
|
||||||
|
|
||||||
if hasattr(cls, "https"):
|
url = cls.example
|
||||||
scheme = "https" if cls.https else "http"
|
return url[:url.find("/", 8)+1]
|
||||||
netloc = cls.__doc__.split()[-1]
|
|
||||||
return "{}://{}/".format(scheme, netloc)
|
|
||||||
|
|
||||||
test = next(cls._get_tests(), None)
|
|
||||||
if test:
|
|
||||||
url = test[0]
|
|
||||||
return url[:url.find("/", 8)+1]
|
|
||||||
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def category_text(c):
|
def category_text(c):
|
||||||
@@ -432,14 +428,10 @@ def build_extractor_list():
|
|||||||
for category, root in extr.instances:
|
for category, root in extr.instances:
|
||||||
base[category].append(extr.subcategory)
|
base[category].append(extr.subcategory)
|
||||||
if category not in domains:
|
if category not in domains:
|
||||||
if not root:
|
if not root and results:
|
||||||
# use domain from first matching test
|
# use domain from first matching test
|
||||||
for url, _ in extr._get_tests():
|
test = results.category(category)[0]
|
||||||
if extr.from_url(url).category == category:
|
root = test["#class"].from_url(test["#url"]).root
|
||||||
root = url[:url.index("/", 8)]
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
domains[category] = root + "/"
|
domains[category] = root + "/"
|
||||||
|
|
||||||
# sort subcategory lists
|
# sort subcategory lists
|
||||||
|
|||||||
Reference in New Issue
Block a user