[wikimedia] combine most wikimedia.org sites (#1443)

add wikidata.org and wikivoyage.org
pull/5195/head
Mike Fährmann 7 months ago
parent c7d17f1111
commit af61d2b037
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -124,7 +124,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Bluesky</td>
<td>https://bsky.app/</td>
<td>Likes, Media Files, Posts, Replies, User Profiles</td>
<td>Feeds, Followed Users, Likes, Lists, Media Files, Posts, Replies, User Profiles</td>
<td>Supported</td>
</tr>
<tr>
@ -1470,44 +1470,8 @@ Consider all listed sites to potentially be NSFW.
<td colspan="4"><strong>Wikimedia Instances</strong></td>
</tr>
<tr>
<td>Wikipedia</td>
<td>https://www.wikipedia.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wiktionary</td>
<td>https://www.wiktionary.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wikiquote</td>
<td>https://www.wikiquote.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wikibooks</td>
<td>https://www.wikibooks.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wikisource</td>
<td>https://www.wikisource.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wikinews</td>
<td>https://www.wikinews.org/</td>
<td>Articles</td>
<td></td>
</tr>
<tr>
<td>Wikiversity</td>
<td>https://www.wikiversity.org/</td>
<td>Wikimedia</td>
<td>https://www.wikimedia.org/</td>
<td>Articles</td>
<td></td>
</tr>

@ -25,7 +25,9 @@ class WikimediaExtractor(BaseExtractor):
BaseExtractor.__init__(self, match)
path = match.group(match.lastindex)
if self.category == "fandom":
if self.category == "wikimedia":
self.category = self.root.split(".")[-2]
elif self.category == "fandom":
self.category = \
"fandom-" + self.root.partition(".")[0].rpartition("/")[2]
@ -119,39 +121,12 @@ class WikimediaExtractor(BaseExtractor):
BASE_PATTERN = WikimediaExtractor.update({
"wikipedia": {
"wikimedia": {
"root": None,
"pattern": r"[a-z]{2,}\.wikipedia\.org",
"api-path": "/w/api.php",
},
"wiktionary": {
"root": None,
"pattern": r"[a-z]{2,}\.wiktionary\.org",
"api-path": "/w/api.php",
},
"wikiquote": {
"root": None,
"pattern": r"[a-z]{2,}\.wikiquote\.org",
"api-path": "/w/api.php",
},
"wikibooks": {
"root": None,
"pattern": r"[a-z]{2,}\.wikibooks\.org",
"api-path": "/w/api.php",
},
"wikisource": {
"root": None,
"pattern": r"[a-z]{2,}\.wikisource\.org",
"api-path": "/w/api.php",
},
"wikinews": {
"root": None,
"pattern": r"[a-z]{2,}\.wikinews\.org",
"api-path": "/w/api.php",
},
"wikiversity": {
"root": None,
"pattern": r"[a-z]{2,}\.wikiversity\.org",
"pattern": r"[a-z]{2,}\."
r"wik(?:i(?:pedia|quote|books|source|news|versity|data"
r"|voyage)|tionary)"
r"\.org",
"api-path": "/w/api.php",
},
"wikispecies": {

@ -325,7 +325,8 @@ BASE_MAP = {
}
URL_MAP = {
"blogspot": "https://www.blogger.com/",
"blogspot" : "https://www.blogger.com/",
"wikimedia": "https://www.wikimedia.org/",
}
_OAUTH = '<a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a>'

@ -0,0 +1,23 @@
# -*- 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.wikidata.org/wiki/Title",
"#category": ("wikimedia", "wikidata", "article"),
"#class" : wikimedia.WikimediaArticleExtractor,
},
{
"#url" : "https://en.wikidata.org/wiki/Category:Title",
"#category": ("wikimedia", "wikidata", "category"),
"#class" : wikimedia.WikimediaArticleExtractor,
},
)

@ -0,0 +1,23 @@
# -*- 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.wikivoyage.org/wiki/Title",
"#category": ("wikimedia", "wikivoyage", "article"),
"#class" : wikimedia.WikimediaArticleExtractor,
},
{
"#url" : "https://en.wikivoyage.org/wiki/Category:Title",
"#category": ("wikimedia", "wikivoyage", "category"),
"#class" : wikimedia.WikimediaArticleExtractor,
},
)
Loading…
Cancel
Save