consistent extractor naming scheme + docstrings

This commit is contained in:
Mike Fährmann
2016-09-12 10:20:57 +02:00
parent 888a988725
commit d7e168799d
50 changed files with 170 additions and 147 deletions

View File

@@ -6,7 +6,7 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extract image-urls from http://safebooru.org/"""
"""Extract images from http://safebooru.org/"""
from . import booru
@@ -26,18 +26,20 @@ class SafebooruExtractor(booru.XMLBooruExtractor):
self.params["pid"] = 0
class SafebooruTagExtractor(SafebooruExtractor, booru.BooruTagExtractor):
"""Extract images from safebooru based on search-tags"""
"""Extractor for images from safebooru.org based on search-tags"""
subcategory = "tag"
pattern = [r"(?:https?://)?(?:www\.)?safebooru\.org/(?:index\.php)?\?page=post&s=list&tags=([^&]+)"]
pattern = [(r"(?:https?://)?(?:www\.)?safebooru\.org/(?:index\.php)?"
r"\?page=post&s=list&tags=([^&]+)")]
test = [("http://safebooru.org/index.php?page=post&s=list&tags=bonocho", {
"url": "c91e04ffbdf317fae95b2e160c8345503d9fb730",
"content": "e5ad4c5bf241b1def154958535bef6c2f6b733eb",
})]
class SafebooruPostExtractor(SafebooruExtractor, booru.BooruPostExtractor):
"""Extract single images from safebooru"""
"""Extractor for single images from safebooru.org"""
subcategory = "post"
pattern = [r"(?:https?://)?(?:www\.)?safebooru\.org/(?:index\.php)?\?page=post&s=view&id=(\d+)"]
pattern = [(r"(?:https?://)?(?:www\.)?safebooru\.org/(?:index\.php)?"
r"\?page=post&s=view&id=(\d+)")]
test = [("http://safebooru.org/index.php?page=post&s=view&id=1169132", {
"url": "bcb6047665729c7c9db243a27f41cbef9af1ecef",
"content": "93b293b27dabd198afafabbaf87c49863ac82f27",