From b57051719fac671db5df4059377f7c4a00280547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 9 Apr 2024 19:24:01 +0200 Subject: [PATCH] [wikimedia] support wiki.gg wikis --- docs/supportedsites.md | 6 ++++++ gallery_dl/extractor/wikimedia.py | 10 +++++++--- scripts/supportedsites.py | 1 + test/results/wikigg.py | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 test/results/wikigg.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index e5665688..9b2a4bc5 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1499,6 +1499,12 @@ Consider all listed sites to potentially be NSFW. Articles + + wiki.gg + https://www.wiki.gg/ + Articles + + Super Mario Wiki https://www.mariowiki.com/ diff --git a/gallery_dl/extractor/wikimedia.py b/gallery_dl/extractor/wikimedia.py index 4976c078..9370cfb5 100644 --- a/gallery_dl/extractor/wikimedia.py +++ b/gallery_dl/extractor/wikimedia.py @@ -27,9 +27,9 @@ class WikimediaExtractor(BaseExtractor): if self.category == "wikimedia": self.category = self.root.split(".")[-2] - elif self.category == "fandom": - self.category = \ - "fandom-" + self.root.partition(".")[0].rpartition("/")[2] + elif self.category in ("fandom", "wikigg"): + self.category = "{}-{}".format( + self.category, self.root.partition(".")[0].rpartition("/")[2]) if path.startswith("wiki/"): path = path[5:] @@ -152,6 +152,10 @@ BASE_PATTERN = WikimediaExtractor.update({ "root": None, "pattern": r"[\w-]+\.fandom\.com", }, + "wikigg": { + "root": None, + "pattern": r"\w+\.wiki\.gg", + }, "mariowiki": { "root": "https://www.mariowiki.com", "pattern": r"(?:www\.)?mariowiki\.com", diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 9748f00a..04b421c4 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -143,6 +143,7 @@ CATEGORY_MAP = { "webmshare" : "webmshare", "webtoons" : "Webtoon", "wikiart" : "WikiArt.org", + "wikigg" : "wiki.gg", "wikimediacommons": "Wikimedia Commons", "xbunkr" : "xBunkr", "xhamster" : "xHamster", diff --git a/test/results/wikigg.py b/test/results/wikigg.py new file mode 100644 index 00000000..ffc5cb70 --- /dev/null +++ b/test/results/wikigg.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +from gallery_dl.extractor import wikimedia + + +__tests__ = ( +{ + "#url" : "https://www.wiki.gg/wiki/Title", + "#comment" : "for scripts/supportedsites.py", + "#category": ("wikimedia", "wikigg-www", "article"), + "#class" : wikimedia.WikimediaArticleExtractor, +}, + +{ + "#url" : "https://hearthstone.wiki.gg/wiki/Flame_Juggler", + "#category": ("wikimedia", "wikigg-hearthstone", "article"), + "#class" : wikimedia.WikimediaArticleExtractor, +}, + +)