From 269dc2bbd58fd708ef40e7517ae1a413e7098865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 13 Jul 2018 16:20:14 +0200 Subject: [PATCH] [sankaku] add 'tags' option (#94) --- docs/configuration.rst | 14 +------------- gallery_dl/extractor/idolcomplex.py | 9 ++++++++- gallery_dl/extractor/sankaku.py | 28 +++++++++++++++++++++++++--- test/test_results.py | 2 ++ 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index d908118f..f6e976e5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -617,19 +617,7 @@ Description A (comma-separated) list of post types to extract images, etc. from. =========== ===== -extractor.3dbooru.tags ----------------------- -extractor.e621.tags -------------------- -extractor.gelbooru.tags ------------------------ -extractor.konachan.tags ------------------------ -extractor.rule34.tags ---------------------- -extractor.safebooru.tags ------------------------- -extractor.yandere.tags +extractor.[booru].tags ---------------------- =========== ===== Type ``bool`` diff --git a/gallery_dl/extractor/idolcomplex.py b/gallery_dl/extractor/idolcomplex.py index ecf40ff1..b020c93c 100644 --- a/gallery_dl/extractor/idolcomplex.py +++ b/gallery_dl/extractor/idolcomplex.py @@ -48,5 +48,12 @@ class IdolcomplexPostExtractor(IdolcomplexExtractor, pattern = [r"(?:https?://)?idol\.sankakucomplex\.com/post/show/(\d+)"] test = [("https://idol.sankakucomplex.com/post/show/694215", { "content": "694ec2491240787d75bf5d0c75d0082b53a85afd", - "count": 1, + "options": (("tags", True),), + "keyword": { + "tags_character": "shani_(the_witcher)", + "tags_copyright": "the_witcher", + "tags_idol": "lyumos", + "tags_medium": "3:2_aspect_ratio cosplay", + "tags_general": str, + }, })] diff --git a/gallery_dl/extractor/sankaku.py b/gallery_dl/extractor/sankaku.py index 001cbb2c..15681cf2 100644 --- a/gallery_dl/extractor/sankaku.py +++ b/gallery_dl/extractor/sankaku.py @@ -11,8 +11,10 @@ from .common import SharedConfigExtractor, Message from .. import text, util, exception from ..cache import cache -import time +import collections import random +import time +import re class SankakuExtractor(SharedConfigExtractor): @@ -30,6 +32,7 @@ class SankakuExtractor(SharedConfigExtractor): self.logged_in = True self.start_page = 1 self.start_post = 0 + self.extags = self.config("tags", False) self.wait_min = self.config("wait-min", 2.5) self.wait_max = self.config("wait-max", 5.0) if self.wait_max < self.wait_min: @@ -81,7 +84,7 @@ class SankakuExtractor(SharedConfigExtractor): height, pos = extr(page, 'height=', '>', pos) file_url = extr(page, '', '')[0] + pattern = re.compile(r'tag-type-([^>]+)>