From ed5ceb6f6e8c211d41bb65d84cb10d56e8989ada Mon Sep 17 00:00:00 2001
From: Black_Yuzia <25010528+BlackYuzia@users.noreply.github.com>
Date: Mon, 7 Mar 2022 09:51:55 +0200
Subject: [PATCH] fix(route): nhentai Images host (#9257)
fix(route): nhentai Images host
---
lib/routes/nhentai/util.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/routes/nhentai/util.js b/lib/routes/nhentai/util.js
index 83d3e4b4f..dba2af215 100644
--- a/lib/routes/nhentai/util.js
+++ b/lib/routes/nhentai/util.js
@@ -91,7 +91,7 @@ const parseSimpleDetail = ($ele) => {
const link = resolve('https://nhentai.net', $ele.attr('href'));
const thumb = $ele.children('img');
const thumbSrc = thumb.attr('data-src') || thumb.attr('src');
- const highResoThumbSrc = thumbSrc.replace('thumb', '1').replace('t.nhentai.net', 'i.nhentai.net');
+ const highResoThumbSrc = thumbSrc.replace('thumb', '1').replace(/t\d+\.nhentai\.net/, 'i.nhentai.net');
return {
title: $ele.children('.caption').text(),
link,
@@ -121,7 +121,7 @@ const getDetail = async (simple) => {
.map((_, ele) => resolve('https://nhentai.net', $(ele).attr('data-src')))
.get()
.map((src) => src.replace(/(.+)(\d+)t\.(.+)/, (_, p1, p2, p3) => `${p1}${p2}.${p3}`)) // thumb to high-quality
- .map((src) => src.replace('t.nhentai.net', 'i.nhentai.net'));
+ .map((src) => src.replace(/t\d+\.nhentai\.net/, 'i.nhentai.net'));
const renderImg = (src) => `
`;
return {