mirror of
https://github.com/venera-app/venera-configs.git
synced 2025-09-27 08:27:24 +00:00
nhentai: fix search
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
"name": "nhentai",
|
||||
"fileName": "nhentai.js",
|
||||
"key": "nhentai",
|
||||
"version": "1.0.3"
|
||||
"version": "1.0.4"
|
||||
},
|
||||
{
|
||||
"name": "紳士漫畫",
|
||||
|
11
nhentai.js
11
nhentai.js
@@ -7,7 +7,7 @@ class Nhentai extends ComicSource {
|
||||
// unique id of the source
|
||||
key = "nhentai"
|
||||
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
|
||||
minAppVersion = "1.0.0"
|
||||
|
||||
@@ -75,7 +75,12 @@ class Nhentai extends ComicSource {
|
||||
parseComicList(html) {
|
||||
let document = new HtmlDocument(html)
|
||||
let comicElements = document.querySelectorAll("div.gallery")
|
||||
let total = Number(document.querySelector("div#content > h1").text);
|
||||
let h1 = document.querySelector("div#content > h1").text
|
||||
let numbers = h1.match(/\d+/g)
|
||||
let total = comicElements.length;
|
||||
if(numbers) {
|
||||
total = parseInt(numbers.join(''))
|
||||
}
|
||||
return {
|
||||
comics: comicElements.map(e => this.parseComic(e)),
|
||||
maxPage: Math.ceil(total / 25)
|
||||
@@ -216,7 +221,7 @@ class Nhentai extends ComicSource {
|
||||
let sort = options[0] || "popular"
|
||||
sort = sort.replaceAll("@", "-")
|
||||
let url = `${this.baseUrl}/search/?q=${keyword}&page=${page}&sort=${sort}`
|
||||
let res = await Network.get(url, {})
|
||||
let res = await Network.get(url);
|
||||
if(res.status !== 200) {
|
||||
throw "Invalid Status Code: " + res.status
|
||||
}
|
||||
|
Reference in New Issue
Block a user