[sankaku] add support for book searches (closes #1204)
This commit is contained in:
@@ -111,7 +111,7 @@ rule #34 https://rule34.paheal.net/ Posts, Tag Searches
|
|||||||
Rule 34 https://rule34.xxx/ Pools, Posts, Tag Searches
|
Rule 34 https://rule34.xxx/ Pools, Posts, Tag Searches
|
||||||
Safebooru https://safebooru.org/ Pools, Posts, Tag Searches
|
Safebooru https://safebooru.org/ Pools, Posts, Tag Searches
|
||||||
Sakugabooru https://www.sakugabooru.com/ Pools, Popular Images, Posts, Tag Searches
|
Sakugabooru https://www.sakugabooru.com/ Pools, Popular Images, Posts, Tag Searches
|
||||||
Sankaku Channel https://sankaku.app/ Pools, Posts, Tag Searches Supported
|
Sankaku Channel https://sankaku.app/ Book Searches, Pools, Posts, Tag Searches Supported
|
||||||
Sankaku Complex https://www.sankakucomplex.com/ Articles, Tag Searches
|
Sankaku Complex https://www.sankakucomplex.com/ Articles, Tag Searches
|
||||||
Sen Manga https://raw.senmanga.com/ Chapters
|
Sen Manga https://raw.senmanga.com/ Chapters
|
||||||
Sense-Scans https://sensescans.com/reader/ Chapters, Manga
|
Sense-Scans https://sensescans.com/reader/ Chapters, Manga
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"""Extractors for https://sankaku.app/"""
|
"""Extractors for https://sankaku.app/"""
|
||||||
|
|
||||||
from .booru import BooruExtractor
|
from .booru import BooruExtractor
|
||||||
|
from .common import Message
|
||||||
from .. import text, exception
|
from .. import text, exception
|
||||||
from ..cache import cache
|
from ..cache import cache
|
||||||
import collections
|
import collections
|
||||||
@@ -163,6 +164,31 @@ class SankakuPostExtractor(SankakuExtractor):
|
|||||||
return SankakuAPI(self).posts(self.post_id)
|
return SankakuAPI(self).posts(self.post_id)
|
||||||
|
|
||||||
|
|
||||||
|
class SankakuBooksExtractor(SankakuExtractor):
|
||||||
|
"""Extractor for books by tag search on sankaku.app"""
|
||||||
|
subcategory = "books"
|
||||||
|
pattern = BASE_PATTERN + r"/books/?\?([^#]*)"
|
||||||
|
test = (
|
||||||
|
("https://sankaku.app/books?tags=aiue_oka", {
|
||||||
|
"range": "1-20",
|
||||||
|
"count": 20,
|
||||||
|
}),
|
||||||
|
("https://beta.sankakucomplex.com/books?tags=aiue_oka"),
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
SankakuExtractor.__init__(self, match)
|
||||||
|
query = text.parse_query(match.group(1))
|
||||||
|
self.tags = text.unquote(query.get("tags", "").replace("+", " "))
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
params = {"tags": self.tags, "pool_type": "0"}
|
||||||
|
for pool in SankakuAPI(self).pools_keyset(params):
|
||||||
|
pool["_extractor"] = SankakuPoolExtractor
|
||||||
|
url = "https://sankaku.app/books/{}".format(pool["id"])
|
||||||
|
yield Message.Queue, url, pool
|
||||||
|
|
||||||
|
|
||||||
class SankakuAPI():
|
class SankakuAPI():
|
||||||
"""Interface for the sankaku.app API"""
|
"""Interface for the sankaku.app API"""
|
||||||
|
|
||||||
@@ -178,6 +204,9 @@ class SankakuAPI():
|
|||||||
params = {"lang": "en"}
|
params = {"lang": "en"}
|
||||||
return self._call("/pools/" + pool_id, params)
|
return self._call("/pools/" + pool_id, params)
|
||||||
|
|
||||||
|
def pools_keyset(self, params):
|
||||||
|
return self._pagination("/pools/keyset", params)
|
||||||
|
|
||||||
def posts(self, post_id):
|
def posts(self, post_id):
|
||||||
params = {
|
params = {
|
||||||
"lang" : "en",
|
"lang" : "en",
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ SUBCATEGORY_MAP = {
|
|||||||
"me" : "pixiv.me Links",
|
"me" : "pixiv.me Links",
|
||||||
"work": "individual Images",
|
"work": "individual Images",
|
||||||
},
|
},
|
||||||
|
"sankaku": {
|
||||||
|
"books": "Book Searches",
|
||||||
|
},
|
||||||
"smugmug": {
|
"smugmug": {
|
||||||
"path": "Images from Users and Folders",
|
"path": "Images from Users and Folders",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user