1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

merge #6432: [koharu] update domain (#6430)

This commit is contained in:
Mike Fährmann 2024-11-15 22:41:46 +01:00
commit ddd325b435
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 56 additions and 34 deletions

View File

@ -511,12 +511,6 @@ Consider all listed sites to potentially be NSFW.
<td>Soundtracks</td> <td>Soundtracks</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>Koharu</td>
<td>https://koharu.to/</td>
<td>Favorites, Galleries, Search Results</td>
<td></td>
</tr>
<tr> <tr>
<td>Komikcast</td> <td>Komikcast</td>
<td>https://komikcast.cz/</td> <td>https://komikcast.cz/</td>
@ -829,6 +823,12 @@ Consider all listed sites to potentially be NSFW.
<td>Articles, Tag Searches</td> <td>Articles, Tag Searches</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>SchaleNetwork</td>
<td>https://niyaniya.moe/</td>
<td>Favorites, Galleries, Search Results</td>
<td></td>
</tr>
<tr> <tr>
<td>Scrolller</td> <td>Scrolller</td>
<td>https://scrolller.com/</td> <td>https://scrolller.com/</td>

View File

@ -6,20 +6,26 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extractors for https://koharu.to/""" """Extractors for https://niyaniya.moe/"""
from .common import GalleryExtractor, Extractor, Message from .common import GalleryExtractor, Extractor, Message
from .. import text, exception from .. import text, exception
from ..cache import cache from ..cache import cache
BASE_PATTERN = r"(?i)(?:https?://)?(?:koharu|anchira)\.to" BASE_PATTERN = (
r"(?i)(?:https?://)?("
r"(?:niyaniya|shupogaki)\.moe|"
r"(?:koharu|anchira|seia)\.to|"
r"(?:hoshino)\.one"
r")"
)
class KoharuExtractor(Extractor): class KoharuExtractor(Extractor):
"""Base class for koharu extractors""" """Base class for koharu extractors"""
category = "koharu" category = "koharu"
root = "https://koharu.to" root = "https://niyaniya.moe"
root_api = "https://api.koharu.to" root_api = "https://api.schale.network"
request_interval = (0.5, 1.5) request_interval = (0.5, 1.5)
def _init(self): def _init(self):
@ -62,7 +68,7 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
archive_fmt = "{id}_{num}" archive_fmt = "{id}_{num}"
request_interval = 0.0 request_interval = 0.0
pattern = BASE_PATTERN + r"/(?:g|reader)/(\d+)/(\w+)" pattern = BASE_PATTERN + r"/(?:g|reader)/(\d+)/(\w+)"
example = "https://koharu.to/g/12345/67890abcde/" example = "https://niyaniya.moe/g/12345/67890abcde/"
TAG_TYPES = { TAG_TYPES = {
0 : "general", 0 : "general",
@ -100,7 +106,7 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
def metadata(self, _): def metadata(self, _):
url = "{}/books/detail/{}/{}".format( 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() self.data = data = self.request(url, headers=self.headers).json()
tags = [] tags = []
@ -179,11 +185,11 @@ class KoharuGalleryExtractor(KoharuExtractor, GalleryExtractor):
break break
except KeyError: except KeyError:
self.log.debug("%s: Format %s is not available", self.log.debug("%s: Format %s is not available",
self.groups[0], fmtid) self.groups[1], fmtid)
else: else:
raise exception.NotFoundError("format") raise exception.NotFoundError("format")
self.log.debug("%s: Selected format %s", self.groups[0], fmtid) self.log.debug("%s: Selected format %s", self.groups[1], fmtid)
fmt["w"] = fmtid fmt["w"] = fmtid
return fmt return fmt
@ -192,10 +198,10 @@ class KoharuSearchExtractor(KoharuExtractor):
"""Extractor for koharu search results""" """Extractor for koharu search results"""
subcategory = "search" subcategory = "search"
pattern = BASE_PATTERN + r"/\?([^#]*)" pattern = BASE_PATTERN + r"/\?([^#]*)"
example = "https://koharu.to/?s=QUERY" example = "https://niyaniya.moe/?s=QUERY"
def items(self): def items(self):
params = text.parse_query(self.groups[0]) params = text.parse_query(self.groups[1])
params["page"] = text.parse_int(params.get("page"), 1) params["page"] = text.parse_int(params.get("page"), 1)
return self._pagination("/books", params) return self._pagination("/books", params)
@ -204,12 +210,12 @@ class KoharuFavoriteExtractor(KoharuExtractor):
"""Extractor for koharu favorites""" """Extractor for koharu favorites"""
subcategory = "favorite" subcategory = "favorite"
pattern = BASE_PATTERN + r"/favorites(?:\?([^#]*))?" pattern = BASE_PATTERN + r"/favorites(?:\?([^#]*))?"
example = "https://koharu.to/favorites" example = "https://niyaniya.moe/favorites"
def items(self): def items(self):
self.login() self.login()
params = text.parse_query(self.groups[0]) params = text.parse_query(self.groups[1])
params["page"] = text.parse_int(params.get("page"), 1) params["page"] = text.parse_int(params.get("page"), 1)
return self._pagination("/favorites", params) return self._pagination("/favorites", params)
@ -226,7 +232,7 @@ class KoharuFavoriteExtractor(KoharuExtractor):
def _login_impl(self, username, password): def _login_impl(self, username, password):
self.log.info("Logging in as %s", username) 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} data = {"uname": username, "passwd": password}
response = self.request( response = self.request(
url, method="POST", headers=self.headers, data=data) url, method="POST", headers=self.headers, data=data)

View File

@ -84,6 +84,7 @@ CATEGORY_MAP = {
"jpgfish" : "JPG Fish", "jpgfish" : "JPG Fish",
"kabeuchi" : "かべうち", "kabeuchi" : "かべうち",
"kemonoparty" : "Kemono", "kemonoparty" : "Kemono",
"koharu" : "SchaleNetwork",
"livedoor" : "livedoor Blog", "livedoor" : "livedoor Blog",
"ohpolly" : "Oh Polly", "ohpolly" : "Oh Polly",
"omgmiamiswimwear": "Omg Miami Swimwear", "omgmiamiswimwear": "Omg Miami Swimwear",

View File

@ -9,7 +9,7 @@ from gallery_dl.extractor import koharu
__tests__ = ( __tests__ = (
{ {
"#url" : "https://koharu.to/g/14216/6c67076fdd45", "#url" : "https://niyaniya.moe/g/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"), "#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor, "#class" : koharu.KoharuGalleryExtractor,
"#pattern" : r"https://kisakisexo.xyz/download/59896/a4fbd1828229/f47639c6abaf1903dd69c36a3d961da84741a1831aa07a2906ce9c74156a5d75\?v=1721626410802&w=0", "#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"), "#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor, "#class" : koharu.KoharuGalleryExtractor,
"#options" : {"cbz": False, "format": "780"}, "#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"), "#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor, "#class" : koharu.KoharuGalleryExtractor,
"#options" : {"cbz": False, "format": "780"}, "#options" : {"cbz": False, "format": "780"},
@ -66,19 +66,34 @@ __tests__ = (
}, },
{ {
"#url" : "https://anchira.to/g/14216/6c67076fdd45", "#url" : "https://koharu.to/g/14216/6c67076fdd45",
"#class": koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://anchira.to/g/14216/6c67076fdd45",
"#class": koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://seia.to/g/14216/6c67076fdd45",
"#class": koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://shupogaki.moe/g/14216/6c67076fdd45",
"#class": koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://hoshino.one/g/14216/6c67076fdd45",
"#class": koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://niyaniya.moe/reader/14216/6c67076fdd45",
"#category": ("", "koharu", "gallery"), "#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor, "#class" : koharu.KoharuGalleryExtractor,
}, },
{ {
"#url" : "https://koharu.to/reader/14216/6c67076fdd45", "#url" : "https://niyaniya.moe/?s=tag:^beach$",
"#category": ("", "koharu", "gallery"),
"#class" : koharu.KoharuGalleryExtractor,
},
{
"#url" : "https://koharu.to/?s=tag:^beach$",
"#category": ("", "koharu", "search"), "#category": ("", "koharu", "search"),
"#class" : koharu.KoharuSearchExtractor, "#class" : koharu.KoharuSearchExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern, "#pattern" : koharu.KoharuGalleryExtractor.pattern,
@ -86,24 +101,24 @@ __tests__ = (
}, },
{ {
"#url" : "https://koharu.to/favorites", "#url" : "https://niyaniya.moe/favorites",
"#category": ("", "koharu", "favorite"), "#category": ("", "koharu", "favorite"),
"#class" : koharu.KoharuFavoriteExtractor, "#class" : koharu.KoharuFavoriteExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern, "#pattern" : koharu.KoharuGalleryExtractor.pattern,
"#auth" : True, "#auth" : True,
"#urls" : [ "#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"), "#category": ("", "koharu", "favorite"),
"#class" : koharu.KoharuFavoriteExtractor, "#class" : koharu.KoharuFavoriteExtractor,
"#pattern" : koharu.KoharuGalleryExtractor.pattern, "#pattern" : koharu.KoharuGalleryExtractor.pattern,
"#auth" : True, "#auth" : True,
"#urls" : [ "#urls" : [
"https://koharu.to/g/14216/6c67076fdd45", "https://niyaniya.moe/g/14216/6c67076fdd45",
], ],
}, },