[shimmie2] support 'soybooru.com' (#8467)
This commit is contained in:
@@ -1657,6 +1657,12 @@ Consider all listed sites to potentially be NSFW.
|
||||
<td>Posts, Tag Searches</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr id="soybooru" title="soybooru">
|
||||
<td>Soybooru</td>
|
||||
<td>https://soybooru.com/</td>
|
||||
<td>Posts, Tag Searches</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr id="szurubooru" title="szurubooru">
|
||||
<td colspan="4"><strong>szurubooru Instances</strong></td>
|
||||
|
||||
@@ -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):
|
||||
|
||||
47
test/results/soybooru.py
Normal file
47
test/results/soybooru.py
Normal file
@@ -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,
|
||||
},
|
||||
|
||||
)
|
||||
Reference in New Issue
Block a user