diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 4271fd8b..a9d32050 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1657,6 +1657,12 @@ Consider all listed sites to potentially be NSFW. Posts, Tag Searches + + Soybooru + https://soybooru.com/ + Posts, Tag Searches + + szurubooru Instances diff --git a/gallery_dl/extractor/shimmie2.py b/gallery_dl/extractor/shimmie2.py index d14ca924..2c6a68db 100644 --- a/gallery_dl/extractor/shimmie2.py +++ b/gallery_dl/extractor/shimmie2.py @@ -25,6 +25,8 @@ class Shimmie2Extractor(BaseExtractor): if file_url := self.config_instance("file_url"): self.file_url_fmt = file_url + if quote := self.config_instance("quote"): + self._quote_type = lambda _: quote def items(self): data = self.metadata() @@ -85,6 +87,11 @@ BASE_PATTERN = Shimmie2Extractor.update({ "root": "https://co.llection.pics", "pattern": r"co\.llection\.pics", }, + "soybooru": { + "root": "https://soybooru.com", + "pattern": r"soybooru\.com", + "quote": "'", + }, }) + r"/(?:index\.php\?q=/?)?" @@ -150,9 +157,8 @@ class Shimmie2TagExtractor(Shimmie2Extractor): } pnum += 1 - if not extr(">Next<", ">"): - if not extr(f"/{pnum}'>{pnum}<", ">"): - return + if not extr(f"/{pnum}{quote}>Next"): + return class Shimmie2PostExtractor(Shimmie2Extractor): diff --git a/test/results/soybooru.py b/test/results/soybooru.py new file mode 100644 index 00000000..6a7046ce --- /dev/null +++ b/test/results/soybooru.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +from gallery_dl.extractor import shimmie2 + + +__tests__ = ( +{ + "#url" : "https://soybooru.com/post/view/142188", + "#category": ("shimmie2", "soybooru", "post"), + "#class" : shimmie2.Shimmie2PostExtractor, + "#results" : "https://soybooru.com/_images/79a229384727558c651816e4c30c9b4d/142188%20-%20SoyBooru.png", + + "extension": "png", + "file_url" : "https://soybooru.com/_images/79a229384727558c651816e4c30c9b4d/142188%20-%20SoyBooru.png", + "filename" : "142188 - SoyBooru", + "height" : 600, + "id" : 142188, + "md5" : "79a229384727558c651816e4c30c9b4d", + "size" : 0, + "tags" : "body clothes dark dark_room glasses hair ominous shadow subvariant:pol_face template variant:chudjak white_shirt white_skin", + "width" : 600, +}, + +{ + "#url" : "https://soybooru.com/post/list/dark_room/1", + "#category": ("shimmie2", "soybooru", "tag"), + "#class" : shimmie2.Shimmie2TagExtractor, + "#pattern" : r"https://soybooru.com/_images/\w{32}/\d+.+\.(jpe?g|png|gif|mp4|webm)", + "#count" : range(16, 24), + + "extension" : str, + "file_url" : str, + "filename" : str, + "height" : int, + "id" : int, + "md5" : "hash:md5", + "search_tags": "dark_room", + "size" : int, + "tags" : str, + "width" : int, +}, + +)