diff --git a/docs/supportedsites.md b/docs/supportedsites.md index ea0b7ae4..2790476f 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1460,61 +1460,61 @@ Consider all listed sites to potentially be NSFW. Wikimedia https://www.wikimedia.org/ - Articles + Articles, Categories, Files, Wikis Wikispecies https://species.wikimedia.org/ - Articles + Articles, Categories, Files, Wikis Wikimedia Commons https://commons.wikimedia.org/ - Articles + Articles, Categories, Files, Wikis MediaWiki https://www.mediawiki.org/ - Articles + Articles, Categories, Files, Wikis Fandom https://www.fandom.com/ - Articles + Articles, Categories, Files, Wikis wiki.gg https://www.wiki.gg/ - Articles + Articles, Categories, Files, Wikis Super Mario Wiki https://www.mariowiki.com/ - Articles + Articles, Categories, Files, Wikis Bulbapedia https://bulbapedia.bulbagarden.net/ - Articles + Articles, Categories, Files, Wikis PidgiWiki https://www.pidgi.net/ - Articles + Articles, Categories, Files, Wikis Azur Lane Wiki https://azurlane.koumakan.jp/ - Articles + Articles, Categories, Files, Wikis diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 4b9acbac..630c3ac2 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -206,7 +206,7 @@ SUBCATEGORY_MAP = { "redirect" : "Pixiv Redirects", }, "fapello": { - "path": "Videos, Trending Posts, Popular Videos, Top Models", + "path": ["Videos", "Trending Posts", "Popular Videos", "Top Models"], }, "furaffinity": { "submissions": "New Submissions", @@ -240,9 +240,6 @@ SUBCATEGORY_MAP = { "mangadex": { "feed" : "Followed Feed", }, - "nana": { - "search": "Favorites, Search Results", - }, "nijie": { "followed": "Followed Users", "nuita" : "Nuita History", @@ -313,7 +310,7 @@ SUBCATEGORY_MAP = { "uploads" : "", }, "wallpapercave": { - "image": "individual Images, Search Results", + "image": ["individual Images", "Search Results"], }, "weasyl": { "journals" : "", @@ -326,6 +323,9 @@ SUBCATEGORY_MAP = { "wikiart": { "artists": "Artist Listings", }, + "wikimedia": { + "article": ["Articles", "Categories", "Files"], + }, } BASE_MAP = { @@ -441,12 +441,23 @@ def category_text(c): return CATEGORY_MAP.get(c) or c.capitalize() -def subcategory_text(c, sc): +def subcategory_text(bc, c, sc): """Return a human-readable representation of a subcategory""" if c in SUBCATEGORY_MAP: scm = SUBCATEGORY_MAP[c] if sc in scm: - return scm[sc] + txt = scm[sc] + if not isinstance(txt, str): + txt = ", ".join(txt) + return txt + + if bc and bc in SUBCATEGORY_MAP: + scm = SUBCATEGORY_MAP[bc] + if sc in scm: + txt = scm[sc] + if not isinstance(txt, str): + txt = ", ".join(txt) + return txt if sc in SUBCATEGORY_MAP: return SUBCATEGORY_MAP[sc] @@ -534,14 +545,14 @@ def build_extractor_list(): # define table columns COLUMNS = ( ("Site", 20, - lambda c, scs, d: category_text(c)), + lambda bc, c, scs, d: category_text(c)), ("URL" , 35, - lambda c, scs, d: d), + lambda bc, c, scs, d: d), ("Capabilities", 50, - lambda c, scs, d: ", ".join(subcategory_text(c, sc) for sc in scs - if subcategory_text(c, sc))), + lambda bc, c, scs, d: ", ".join(subcategory_text(bc, c, sc) for sc in scs + if subcategory_text(bc, c, sc))), ("Authentication", 16, - lambda c, scs, d: AUTH_MAP.get(c, "")), + lambda bc, c, scs, d: AUTH_MAP.get(c, "")), ) @@ -557,10 +568,10 @@ def generate_output(columns, categories, domains): tbody = [] append = tbody.append - for name, base in categories.items(): + for bcat, base in categories.items(): - if name and base: - name = BASE_MAP.get(name) or (name.capitalize() + " Instances") + if bcat and base: + name = BASE_MAP.get(bcat) or (bcat.capitalize() + " Instances") append('\n\n ' + name + '\n') clist = base.items() @@ -571,7 +582,7 @@ def generate_output(columns, categories, domains): append("") for column in columns: domain = domains[category] - content = column[2](category, subcategories, domain) + content = column[2](bcat, category, subcategories, domain) append(" " + content + "") append("")