Skip to content

Commit

Permalink
[koharu] updat root and root_api change
Browse files Browse the repository at this point in the history
  • Loading branch information
K0ng2 authored and mikf committed Nov 15, 2024
1 parent c82f3db commit a09d9ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions gallery_dl/extractor/koharu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from .. import text, exception
from ..cache import cache

BASE_PATTERN = r"(?i)(?:https?://)?(?:koharu|anchira)\.to"
BASE_PATTERN = r"(?i)(?:https?://)?((?:anchira|seia)\.to|(?:niyaniya|shupogaki)\.moe|hoshino\.one)"


class KoharuExtractor(Extractor):
"""Base class for koharu extractors"""
category = "koharu"
root = "https://koharu.to"
root_api = "https://api.koharu.to"
root = "https://niyaniya.moe"
root_api = "https://api.schale.network"
request_interval = (0.5, 1.5)

def _init(self):
Expand Down Expand Up @@ -62,7 +62,7 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
archive_fmt = "{id}_{num}"
request_interval = 0.0
pattern = BASE_PATTERN + r"/(?:g|reader)/(\d+)/(\w+)"
example = "https://koharu.to/g/12345/67890abcde/"
example = "https://niyaniya.moe/g/12345/67890abcde/"

TAG_TYPES = {
0 : "general",
Expand Down Expand Up @@ -100,7 +100,7 @@ def _init(self):

def metadata(self, _):
url = "{}/books/detail/{}/{}".format(
self.root_api, self.groups[0], self.groups[1])
self.root_api, self.groups[1], self.groups[2])
self.data = data = self.request(url, headers=self.headers).json()

tags = []
Expand Down Expand Up @@ -192,7 +192,7 @@ class KoharuSearchExtractor(KoharuExtractor):
"""Extractor for koharu search results"""
subcategory = "search"
pattern = BASE_PATTERN + r"/\?([^#]*)"
example = "https://koharu.to/?s=QUERY"
example = "https://niyaniya.moe/?s=QUERY"

def items(self):
params = text.parse_query(self.groups[0])
Expand All @@ -204,7 +204,7 @@ class KoharuFavoriteExtractor(KoharuExtractor):
"""Extractor for koharu favorites"""
subcategory = "favorite"
pattern = BASE_PATTERN + r"/favorites(?:\?([^#]*))?"
example = "https://koharu.to/favorites"
example = "https://niyaniya.moe/favorites"

def items(self):
self.login()
Expand All @@ -226,7 +226,7 @@ def login(self):
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)

url = "https://auth.koharu.to/login"
url = "https://auth.schale.network/login"
data = {"uname": username, "passwd": password}
response = self.request(
url, method="POST", headers=self.headers, data=data)
Expand Down
18 changes: 9 additions & 9 deletions test/results/koharu.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

__tests__ = (
{
"#url" : "https://koharu.to/g/14216/6c67076fdd45",
"#url" : "https://niyaniya.moe/g/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor,
"#pattern" : r"https://kisakisexo.xyz/download/59896/a4fbd1828229/f47639c6abaf1903dd69c36a3d961da84741a1831aa07a2906ce9c74156a5d75\?v=1721626410802&w=0",
Expand Down Expand Up @@ -48,7 +48,7 @@
},

{
"#url" : "https://koharu.to/g/14216/6c67076fdd45",
"#url" : "https://niyaniya.moe/g/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor,
"#options" : {"cbz": False, "format": "780"},
Expand All @@ -57,7 +57,7 @@
},

{
"#url" : "https://koharu.to/g/14216/6c67076fdd45",
"#url" : "https://niyaniya.moe/g/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor,
"#options" : {"cbz": False, "format": "780"},
Expand All @@ -72,38 +72,38 @@
},

{
"#url" : "https://koharu.to/reader/14216/6c67076fdd45",
"#url" : "https://niyaniya.moe/reader/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor,
},

{
"#url" : "https://koharu.to/?s=tag:^beach$",
"#url" : "https://niyaniya.moe/?s=tag:^beach$",
"#category": ("", "koharu", "search"),
"#class" : koharu.KoharuSearchExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern,
"#count" : ">= 50",
},

{
"#url" : "https://koharu.to/favorites",
"#url" : "https://niyaniya.moe/favorites",
"#category": ("", "koharu", "favorite"),
"#class" : koharu.KoharuFavoriteExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern,
"#auth" : True,
"#urls" : [
"https://koharu.to/g/14216/6c67076fdd45",
"https://niyaniya.moe/g/14216/6c67076fdd45",
],
},

{
"#url" : "https://koharu.to/favorites?cat=6&sort=4",
"#url" : "https://niyaniya.moe/favorites?cat=6&sort=4",
"#category": ("", "koharu", "favorite"),
"#class" : koharu.KoharuFavoriteExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern,
"#auth" : True,
"#urls" : [
"https://koharu.to/g/14216/6c67076fdd45",
"https://niyaniya.moe/g/14216/6c67076fdd45",
],
},

Expand Down

0 comments on commit a09d9ed

Please sign in to comment.