Debian Codegraph @

gallery_dl/extractor/idolcomplex.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2018-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://www.idolcomplex.com/"""
10
11 from . import sankaku
12
13 BASE_PATTERN = (r"(?:https?://)?(?:www\.)?"
14 r"idol(?:\.sankaku)?complex\.com"
15 r"(?:/[a-z]{2}(?:[-_][A-Z]{2})?)?")
16
17
18 class IdolcomplexBase():
19 """Base class for idolcomplex extractors"""
20 category = "idolcomplex"
21 root = "https://www.idolcomplex.com"
22 cookies_domain = ".idolcomplex.com"
23
24 def _init(self):
25 self.api = sankaku.SankakuAPI(self)
26 self.api.ROOT = "https://i.sankakuapi.com"
27 self.api.headers["Origin"] = self.root
28
29
30 class IdolcomplexTagExtractor(IdolcomplexBase, sankaku.SankakuTagExtractor):
31 """Extractor for idolcomplex tag searches"""
32 pattern = BASE_PATTERN + r"(?:/posts)?/?\?([^#]*)"
33 example = "https://www.idolcomplex.com/en/posts?tags=TAGS"
34
35
36 class IdolcomplexPoolExtractor(IdolcomplexBase, sankaku.SankakuPoolExtractor):
37 """Extractor for idolcomplex pools"""
38 pattern = BASE_PATTERN + r"/pools?/(?:show/)?(\w+)"
39 example = "https://www.idolcomplex.com/en/pools/0123456789abcdef"
40
41
42 class IdolcomplexPostExtractor(IdolcomplexBase, sankaku.SankakuPostExtractor):
43 """Extractor for individual idolcomplex posts"""
44 pattern = BASE_PATTERN + r"/posts?(?:/show)?/(\w+)"
45 example = "https://www.idolcomplex.com/en/posts/0123456789abcdef"