[e621] update to new format

This commit is contained in:
Mike Fährmann
2015-11-21 01:56:49 +01:00
parent 1bce63124b
commit 23208a49b8

View File

@@ -8,21 +8,24 @@
"""Extract image-urls from https://e621.net/""" """Extract image-urls from https://e621.net/"""
from .booru import JSONBooruExtractor from . import booru
info = { class E621Extractor(booru.JSONBooruExtractor):
"category": "e621", """Base class for e621 extractors"""
"extractor": "E621Extractor", category = "e621"
"directory": ["{category}", "{tags}"], api_url = "https://e621.net/post/index.json"
"filename": "{category}_{id}_{md5}.{extension}",
"pattern": [ class E621TagExtractor(E621Extractor, booru.BooruTagExtractor):
"""Extract images from e621 based on search-tags"""
pattern = [
r"(?:https?://)?(?:www\.)?e621\.net/post/index/\d+/([^?]+)", r"(?:https?://)?(?:www\.)?e621\.net/post/index/\d+/([^?]+)",
r"(?:https?://)?(?:www\.)?e621\.net/post\?tags=([^&]+).*" r"(?:https?://)?(?:www\.)?e621\.net/post\?tags=([^&]+)",
], ]
}
class E621Extractor(JSONBooruExtractor): class E621PoolExtractor(E621Extractor, booru.BooruPoolExtractor):
"""Extract image-pools from e621"""
pattern = [r"(?:https?://)?(?:www\.)?e621\.net/pool/show/(\d+)"]
def __init__(self, match): class E621PostExtractor(E621Extractor, booru.BooruPostExtractor):
JSONBooruExtractor.__init__(self, match, info) """Extract single images from e621"""
self.api_url = "https://e621.net/post/index.json" pattern = [r"(?:https?://)?(?:www\.)?e621\.net/post/show/(\d+)"]