mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[wikimedia] add 'wiki' extractor
This commit is contained in:
parent
a3b2c88fbe
commit
33d2ddd9fb
@ -193,3 +193,19 @@ class WikimediaArticleExtractor(WikimediaExtractor):
|
||||
def prepare(self, image):
|
||||
WikimediaExtractor.prepare(image)
|
||||
image["page"] = self.title
|
||||
|
||||
|
||||
class WikimediaWikiExtractor(WikimediaExtractor):
|
||||
"""Extractor for all files on a MediaWiki instance"""
|
||||
subcategory = "wiki"
|
||||
pattern = BASE_PATTERN + r"/?$"
|
||||
example = "https://en.wikipedia.org/"
|
||||
|
||||
def __init__(self, match):
|
||||
WikimediaExtractor.__init__(self, match)
|
||||
|
||||
# ref: https://www.mediawiki.org/wiki/API:Allpages
|
||||
self.params = {
|
||||
"generator" : "allpages",
|
||||
"gapnamespace": 6, # "File" namespace
|
||||
}
|
||||
|
@ -98,4 +98,12 @@ __tests__ = (
|
||||
"#class" : wikimedia.WikimediaArticleExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://youtube.fandom.com",
|
||||
"#category": ("wikimedia", "fandom-youtube", "wiki"),
|
||||
"#class" : wikimedia.WikimediaWikiExtractor,
|
||||
"#range" : "1-20",
|
||||
"#count" : 20,
|
||||
},
|
||||
|
||||
)
|
||||
|
@ -50,4 +50,12 @@ __tests__ = (
|
||||
"#class" : wikimedia.WikimediaArticleExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://en.wikipedia.org",
|
||||
"#category": ("wikimedia", "wikipedia", "wiki"),
|
||||
"#class" : wikimedia.WikimediaWikiExtractor,
|
||||
"#range" : "1-10",
|
||||
"#count" : 10,
|
||||
},
|
||||
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user