[hdoujin] add support (#6810)
This commit is contained in:
@@ -73,6 +73,7 @@ modules = [
|
||||
"girlswithmuscle",
|
||||
"gofile",
|
||||
"hatenablog",
|
||||
"hdoujin",
|
||||
"hentai2read",
|
||||
"hentaicosplays",
|
||||
"hentaifoundry",
|
||||
|
||||
42
gallery_dl/extractor/hdoujin.py
Normal file
42
gallery_dl/extractor/hdoujin.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2025 Mike Fährmann
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Extractors for https://hdoujin.org/"""
|
||||
|
||||
from . import schalenetwork
|
||||
|
||||
BASE_PATTERN = r"(?:https?://)?(?:www\.)?(hdoujin\.(?:org|net))"
|
||||
|
||||
|
||||
class HdoujinBase():
|
||||
"""Base class for hdoujin extractors"""
|
||||
category = "hdoujin"
|
||||
root = "https://hdoujin.org"
|
||||
root_api = "https://api.hdoujin.org"
|
||||
root_auth = "https://auth.hdoujin.org"
|
||||
|
||||
|
||||
class HdoujinGalleryExtractor(
|
||||
HdoujinBase, schalenetwork.SchalenetworkGalleryExtractor):
|
||||
pattern = rf"{BASE_PATTERN}/(?:g|reader)/(\d+)/(\w+)"
|
||||
example = "https://hdoujin.org/g/12345/67890abcdef/"
|
||||
|
||||
|
||||
class HdoujinSearchExtractor(
|
||||
HdoujinBase, schalenetwork.SchalenetworkSearchExtractor):
|
||||
pattern = rf"{BASE_PATTERN}/(?:tag/([^/?#]+)|browse)?(?:/?\?([^#]*))?$"
|
||||
example = "https://hdoujin.org/browse?s=QUERY"
|
||||
|
||||
|
||||
class HdoujinFavoriteExtractor(
|
||||
HdoujinBase, schalenetwork.SchalenetworkFavoriteExtractor):
|
||||
pattern = rf"{BASE_PATTERN}/favorites(?:\?([^#]*))?"
|
||||
example = "https://hdoujin.org/favorites"
|
||||
|
||||
|
||||
HdoujinBase.extr_class = HdoujinGalleryExtractor
|
||||
@@ -27,6 +27,7 @@ class SchalenetworkExtractor(Extractor):
|
||||
root = "https://niyaniya.moe"
|
||||
root_api = "https://api.schale.network"
|
||||
root_auth = "https://auth.schale.network"
|
||||
extr_class = None
|
||||
request_interval = (0.5, 1.5)
|
||||
|
||||
def _init(self):
|
||||
@@ -38,6 +39,7 @@ class SchalenetworkExtractor(Extractor):
|
||||
|
||||
def _pagination(self, endpoint, params):
|
||||
url_api = self.root_api + endpoint
|
||||
cls = self.extr_class
|
||||
|
||||
while True:
|
||||
data = self.request_json(
|
||||
@@ -50,7 +52,7 @@ class SchalenetworkExtractor(Extractor):
|
||||
|
||||
for entry in entries:
|
||||
url = f"{self.root}/g/{entry['id']}/{entry['key']}"
|
||||
entry["_extractor"] = SchalenetworkGalleryExtractor
|
||||
entry["_extractor"] = cls
|
||||
yield Message.Queue, url, entry
|
||||
|
||||
try:
|
||||
@@ -236,3 +238,6 @@ class SchalenetworkFavoriteExtractor(SchalenetworkExtractor):
|
||||
params["page"] = text.parse_int(params.get("page"), 1)
|
||||
self.headers["Authorization"] = self._token()
|
||||
return self._pagination(f"/books/favorites?crt={self._crt()}", params)
|
||||
|
||||
|
||||
SchalenetworkExtractor.extr_class = SchalenetworkGalleryExtractor
|
||||
|
||||
Reference in New Issue
Block a user