mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
put common directory- and filename formats in base classes
This commit is contained in:
parent
bce51e90a5
commit
c184e47ee3
@ -17,6 +17,7 @@ import urllib.parse
|
||||
|
||||
class BooruExtractor(Extractor):
|
||||
"""Base class for all booru extractors"""
|
||||
filename_fmt = "{category}_{id}_{md5}.{extension}"
|
||||
info = {}
|
||||
headers = {}
|
||||
pagestart = 1
|
||||
@ -113,7 +114,6 @@ class XMLBooruExtractor(BooruExtractor):
|
||||
class BooruTagExtractor(BooruExtractor):
|
||||
"""Extractor for images based on search-tags"""
|
||||
directory_fmt = ["{category}", "{tags}"]
|
||||
filename_fmt = "{category}_{id}_{md5}.{extension}"
|
||||
|
||||
def __init__(self, match):
|
||||
BooruExtractor.__init__(self)
|
||||
@ -127,7 +127,6 @@ class BooruTagExtractor(BooruExtractor):
|
||||
class BooruPoolExtractor(BooruExtractor):
|
||||
"""Extractor for image-pools"""
|
||||
directory_fmt = ["{category}", "pool", "{pool}"]
|
||||
filename_fmt = "{category}_{id}_{md5}.{extension}"
|
||||
|
||||
def __init__(self, match):
|
||||
BooruExtractor.__init__(self)
|
||||
@ -140,9 +139,6 @@ class BooruPoolExtractor(BooruExtractor):
|
||||
|
||||
class BooruPostExtractor(BooruExtractor):
|
||||
"""Extractor for single images"""
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{category}_{id}_{md5}.{extension}"
|
||||
|
||||
def __init__(self, match):
|
||||
BooruExtractor.__init__(self)
|
||||
self.post = match.group(1)
|
||||
|
@ -22,8 +22,8 @@ class Extractor():
|
||||
|
||||
category = ""
|
||||
subcategory = ""
|
||||
directory_fmt = [""]
|
||||
filename_fmt = ""
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
|
||||
def __init__(self):
|
||||
self.session = requests.Session()
|
||||
|
@ -15,8 +15,6 @@ from .. import text
|
||||
class DirectlinkExtractor(Extractor):
|
||||
"""Extractor for direct links to images"""
|
||||
category = "directlink"
|
||||
directory_fmt = []
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"https?://[^?&#]+\.(?:jpe?g|png|gif|webm|mp4|ogg)"]
|
||||
test = [(("https://photos.smugmug.com/The-World/Hawaii/"
|
||||
"i-SWz2K6n/2/X3/IMG_0311-X3.jpg"), {
|
||||
|
@ -39,7 +39,6 @@ class GfycatExtractor(Extractor):
|
||||
class GfycatImageExtractor(GfycatExtractor):
|
||||
"""Extractor for individual images from gfycat.com"""
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{category}_{gfyName}.{extension}"
|
||||
pattern = [r"(?:https?://)?(?:[a-z]+\.)?gfycat\.com/"
|
||||
r"(?:(?:gifs/)?detail/|ifr/)?([A-Za-z]+)"]
|
||||
|
@ -74,8 +74,6 @@ class ImagebamImageExtractor(Extractor):
|
||||
"""Extractor for single images from imagebam.com"""
|
||||
category = "imagebam"
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?imagebam\.com/image/([0-9a-f]{15})"]
|
||||
test = [("http://www.imagebam.com/image/94d56c502511890", {
|
||||
"url": "94add9417c685d113a91bcdda4916e9538b5f8a9",
|
||||
|
@ -18,8 +18,6 @@ from urllib.parse import urljoin
|
||||
class ImagehostImageExtractor(Extractor):
|
||||
"""Base class for single-image extractors for various imagehosts"""
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
https = False
|
||||
method = "post"
|
||||
params = "simple"
|
||||
|
@ -82,8 +82,6 @@ class ImgboxImageExtractor(Extractor):
|
||||
"""Extractor for single images from imgbox.com"""
|
||||
category = "imgbox"
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?imgbox\.com/([A-Za-z0-9]{8})"]
|
||||
test = [
|
||||
("https://imgbox.com/qHhw7lpG", {
|
||||
|
@ -15,7 +15,6 @@ from .. import text
|
||||
class ImgchiliExtractor(Extractor):
|
||||
"""Base class for imgchili extractors"""
|
||||
category = "imgchili"
|
||||
directory_fmt = ["{category}"]
|
||||
url_base = "https://imgchili.net/"
|
||||
|
||||
def __init__(self, match):
|
||||
@ -46,7 +45,6 @@ class ImgchiliExtractor(Extractor):
|
||||
class ImgchiliImageExtractor(ImgchiliExtractor):
|
||||
"""Extractor for single images from imgchili.net"""
|
||||
subcategory = "image"
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?(?:www\.)?imgchili\.net/show/\d+/(\d+)_[^/]+"]
|
||||
test = [(("http://imgchili.net/show/89427/"
|
||||
"89427136_test___quot;___gt;.png"), {
|
||||
|
@ -54,7 +54,6 @@ class ImgurImageExtractor(ImgurExtractor):
|
||||
"""Extractor for individual images from imgur.com"""
|
||||
category = "imgur"
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{category}_{hash}.{extension}"
|
||||
pattern = [(r"(?:https?://)?(?:m\.|www\.)?imgur\.com/"
|
||||
r"(?:gallery/)?((?!gallery)[^/?&#]{7})/?"),
|
||||
|
@ -17,7 +17,6 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor):
|
||||
category = "khinsider"
|
||||
subcategory = "soundtrack"
|
||||
directory_fmt = ["{category}", "{album}"]
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?downloads\.khinsider\.com/"
|
||||
r"game-soundtracks/album/(.+)"]
|
||||
test = [(("http://downloads.khinsider.com/game-soundtracks/"
|
||||
|
@ -15,7 +15,6 @@ from .. import text, exception
|
||||
class PinterestExtractor(Extractor):
|
||||
"""Base class for pinterest extractors"""
|
||||
category = "pinterest"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{category}_{pin-id}.{extension}"
|
||||
|
||||
def __init__(self):
|
||||
|
@ -114,7 +114,6 @@ class SeigaUserExtractor(SeigaExtractor):
|
||||
class SeigaImageExtractor(SeigaExtractor):
|
||||
"""Extractor for single images from seiga.nicovideo.jp"""
|
||||
subcategory = "image"
|
||||
directory_fmt = ["{category}"]
|
||||
filename_fmt = "{category}_{image-id}.{extension}"
|
||||
pattern = [(r"(?:https?://)?(?:www\.|seiga\.)?nicovideo\.jp/"
|
||||
r"(?:seiga/im|image/source/)(\d+)"),
|
||||
|
Loading…
Reference in New Issue
Block a user