mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
rename extractor classes starting with a digit
This commit is contained in:
parent
b3b9da6d74
commit
2a3bd4e3c7
@ -6,13 +6,13 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
"""Extract images from https://www.2chan.net/"""
|
||||
"""Extractors for https://www.2chan.net/"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text
|
||||
|
||||
|
||||
class FutabaThreadExtractor(Extractor):
|
||||
class _2chanThreadExtractor(Extractor):
|
||||
"""Extractor for images from threads on www.2chan.net"""
|
||||
category = "2chan"
|
||||
subcategory = "thread"
|
||||
|
@ -11,7 +11,7 @@
|
||||
from . import booru
|
||||
|
||||
|
||||
class ThreedeebooruExtractor(booru.MoebooruPageMixin, booru.BooruExtractor):
|
||||
class _3dbooruExtractor(booru.MoebooruPageMixin, booru.BooruExtractor):
|
||||
"""Base class for 3dbooru extractors"""
|
||||
category = "3dbooru"
|
||||
api_url = "http://behoimi.org/post/index.json"
|
||||
@ -26,8 +26,7 @@ class ThreedeebooruExtractor(booru.MoebooruPageMixin, booru.BooruExtractor):
|
||||
})
|
||||
|
||||
|
||||
class ThreedeebooruTagExtractor(booru.TagMixin,
|
||||
ThreedeebooruExtractor):
|
||||
class _3dbooruTagExtractor(booru.TagMixin, _3dbooruExtractor):
|
||||
"""Extractor for images from behoimi.org based on search-tags"""
|
||||
pattern = (r"(?:https?://)?(?:www\.)?behoimi\.org/post"
|
||||
r"(?:/(?:index)?)?\?tags=(?P<tags>[^&#]+)")
|
||||
@ -37,8 +36,7 @@ class ThreedeebooruTagExtractor(booru.TagMixin,
|
||||
})
|
||||
|
||||
|
||||
class ThreedeebooruPoolExtractor(booru.PoolMixin,
|
||||
ThreedeebooruExtractor):
|
||||
class _3dbooruPoolExtractor(booru.PoolMixin, _3dbooruExtractor):
|
||||
"""Extractor for image-pools from behoimi.org"""
|
||||
pattern = r"(?:https?://)?(?:www\.)?behoimi\.org/pool/show/(?P<pool>\d+)"
|
||||
test = ("http://behoimi.org/pool/show/27", {
|
||||
@ -47,8 +45,7 @@ class ThreedeebooruPoolExtractor(booru.PoolMixin,
|
||||
})
|
||||
|
||||
|
||||
class ThreedeebooruPostExtractor(booru.PostMixin,
|
||||
ThreedeebooruExtractor):
|
||||
class _3dbooruPostExtractor(booru.PostMixin, _3dbooruExtractor):
|
||||
"""Extractor for single images from behoimi.org"""
|
||||
pattern = r"(?:https?://)?(?:www\.)?behoimi\.org/post/show/(?P<post>\d+)"
|
||||
test = ("http://behoimi.org/post/show/140852", {
|
||||
@ -64,8 +61,7 @@ class ThreedeebooruPostExtractor(booru.PostMixin,
|
||||
})
|
||||
|
||||
|
||||
class ThreedeebooruPopularExtractor(booru.MoebooruPopularMixin,
|
||||
ThreedeebooruExtractor):
|
||||
class _3dbooruPopularExtractor(booru.MoebooruPopularMixin, _3dbooruExtractor):
|
||||
"""Extractor for popular images from behoimi.org"""
|
||||
pattern = (r"(?:https?://)?(?:www\.)?behoimi\.org"
|
||||
r"/post/popular_(?P<scale>by_(?:day|week|month)|recent)"
|
||||
|
@ -78,7 +78,7 @@ class FoolfuukaThreadExtractor(SharedConfigMixin, Extractor):
|
||||
|
||||
EXTRACTORS = {
|
||||
"4plebs": {
|
||||
"name": "fourplebs",
|
||||
"name": "_4plebs",
|
||||
"root": "https://archive.4plebs.org",
|
||||
"pattern": r"(?:archive\.)?4plebs\.org",
|
||||
"test-thread": ("https://archive.4plebs.org/tg/thread/54059290", {
|
||||
|
@ -157,22 +157,12 @@ class TestExtractor(unittest.TestCase):
|
||||
def capitalize(c):
|
||||
if "-" in c:
|
||||
return string.capwords(c.replace("-", " ")).replace(" ", "")
|
||||
if "." in c:
|
||||
c = c.replace(".", "")
|
||||
return c.capitalize()
|
||||
|
||||
mapping = {
|
||||
"2chan" : "futaba",
|
||||
"3dbooru": "threedeebooru",
|
||||
"4plebs" : "fourplebs",
|
||||
"oauth" : None,
|
||||
}
|
||||
|
||||
for extr in extractor.extractors():
|
||||
category = mapping.get(extr.category, extr.category)
|
||||
if category:
|
||||
if extr.category not in ("", "oauth"):
|
||||
expected = "{}{}Extractor".format(
|
||||
capitalize(category),
|
||||
capitalize(extr.category),
|
||||
capitalize(extr.subcategory),
|
||||
)
|
||||
if expected[0].isdigit():
|
||||
|
Loading…
Reference in New Issue
Block a user