Debian Codegraph @

gallery_dl/extractor/hdoujin.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2025 Mike Fährmann
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8
9 """Extractors for https://hdoujin.org/"""
10
11 from . import schalenetwork
12
13 BASE_PATTERN = r"(?:https?://)?(?:www\.)?(hdoujin\.(?:org|net))"
14
15
16 class HdoujinBase():
17 """Base class for hdoujin extractors"""
18 category = "hdoujin"
19 root = "https://hdoujin.org"
20 root_api = "https://api.hdoujin.org"
21 root_auth = "https://auth.hdoujin.org"
22
23
24 class HdoujinGalleryExtractor(
25 HdoujinBase, schalenetwork.SchalenetworkGalleryExtractor):
26 pattern = BASE_PATTERN + r"/(?:g|reader)/(\d+)/(\w+)"
27 example = "https://hdoujin.org/g/12345/67890abcdef/"
28
29
30 class HdoujinSearchExtractor(
31 HdoujinBase, schalenetwork.SchalenetworkSearchExtractor):
32 pattern = BASE_PATTERN + r"/(?:tag/([^/?#]+)|browse)?(?:/?\?([^#]*))?$"
33 example = "https://hdoujin.org/browse?s=QUERY"
34
35
36 class HdoujinFavoriteExtractor(
37 HdoujinBase, schalenetwork.SchalenetworkFavoriteExtractor):
38 pattern = BASE_PATTERN + r"/favorites(?:\?([^#]*))?"
39 example = "https://hdoujin.org/favorites"
40
41
42 HdoujinBase.extr_class = HdoujinGalleryExtractor