From a09d9edaa616173ccb68e4c580356c2f006df8d0 Mon Sep 17 00:00:00 2001 From: K0ng2 <98278668+K0ng2@users.noreply.github.com> Date: Thu, 7 Nov 2024 07:14:01 +0000 Subject: [PATCH] [koharu] updat root and root_api change --- gallery_dl/extractor/koharu.py | 16 ++++++++-------- test/results/koharu.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gallery_dl/extractor/koharu.py b/gallery_dl/extractor/koharu.py index cacf5046..91792fd4 100644 --- a/gallery_dl/extractor/koharu.py +++ b/gallery_dl/extractor/koharu.py @@ -12,14 +12,14 @@ from .common import GalleryExtractor, Extractor, Message 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): @@ -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", @@ -100,7 +100,7 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor): 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 = [] @@ -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]) @@ -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() @@ -226,7 +226,7 @@ class KoharuFavoriteExtractor(KoharuExtractor): 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) diff --git a/test/results/koharu.py b/test/results/koharu.py index 3ab23505..d2597342 100644 --- a/test/results/koharu.py +++ b/test/results/koharu.py @@ -9,7 +9,7 @@ from gallery_dl.extractor import koharu __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", @@ -48,7 +48,7 @@ __tests__ = ( }, { - "#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"}, @@ -57,7 +57,7 @@ __tests__ = ( }, { - "#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"}, @@ -72,13 +72,13 @@ __tests__ = ( }, { - "#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, @@ -86,24 +86,24 @@ __tests__ = ( }, { - "#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", ], },