From 2e8914675470e5cdca3e3236d24ae5195a2074aa Mon Sep 17 00:00:00 2001 From: nyne Date: Tue, 26 Nov 2024 15:55:15 +0800 Subject: [PATCH] [nhentai] fix tag and title --- index.json | 2 +- nhentai.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/index.json b/index.json index 6e683ad..c6987c8 100644 --- a/index.json +++ b/index.json @@ -33,7 +33,7 @@ "name": "nhentai", "fileName": "nhentai.js", "key": "nhentai", - "version": "1.0.2" + "version": "1.0.3" }, { "name": "紳士漫畫", diff --git a/nhentai.js b/nhentai.js index 930983e..93e3426 100644 --- a/nhentai.js +++ b/nhentai.js @@ -7,7 +7,7 @@ class Nhentai extends ComicSource { // unique id of the source key = "nhentai" - version = "1.0.2" + version = "1.0.3" minAppVersion = "1.0.0" @@ -183,7 +183,8 @@ class Nhentai extends ComicSource { } category = category.replaceAll(" ", "-") let sort = (options[0] || "popular").replaceAll("@", "-") - let url = `${this.baseUrl}/${param}/${category}${sort}?page=${page}` + category = category.replaceAll('.', '-'); + let url = `${this.baseUrl}/${param}/${encodeURIComponent(category)}${sort}?page=${page}` let res = await Network.get(url, {}) return this.parseComicList(res.body) }, @@ -305,8 +306,12 @@ class Nhentai extends ComicSource { } let document = new HtmlDocument(res.body) let cover = document.querySelector("div#cover > a > img").attributes["data-src"]; - let title = document.querySelector("h1.title").text; - let subtitle = document.querySelector("h2.subtitle")?.text; + let title = document.querySelector("h2.title")?.text; + let subtitle = document.querySelector("h1.title").text; + if(!title) { + title = subtitle + subtitle = null + } let tags = new Map(); let uploadTime = new Date(Date.parse(document.querySelector("time")?.attributes["datetime"])) let formatTime = (time) => {