adjusted novel sources

This commit is contained in:
Schnitzel5
2025-01-07 23:38:20 +01:00
parent 36ba1e6c59
commit d16374c57a
3 changed files with 60 additions and 48 deletions

View File

@@ -7,7 +7,7 @@ const mangayomiSources = [{
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.novelupdates.png", "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.novelupdates.png",
"typeSource": "single", "typeSource": "single",
"itemType": 2, "itemType": 2,
"version": "0.0.2", "version": "0.0.3",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "novel/src/en/novelupdates.js", "pkgPath": "novel/src/en/novelupdates.js",
@@ -188,8 +188,13 @@ class DefaultExtension extends MProvider {
"User-Agent": "User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
}); });
const doc = new Document(res.body); return await this.cleanHtmlContent(res.body);
const domain = res.body; }
async cleanHtmlContent(html) {
const client = await new Client();
const doc = new Document(html);
const domain = html;
if (domain.includes("anotivereads")) { if (domain.includes("anotivereads")) {
const title = const title =
@@ -424,7 +429,6 @@ class DefaultExtension extends MProvider {
return e?.toLowerCase().includes("wordpress") || e?.toLowerCase().includes("site kit by google") return e?.toLowerCase().includes("wordpress") || e?.toLowerCase().includes("site kit by google")
}); });
let title = let title =
doc.selectFirst(".entry-title")?.text.trim() || doc.selectFirst(".entry-title")?.text.trim() ||
doc.selectFirst(".entry-title-main")?.text.trim() || doc.selectFirst(".entry-title-main")?.text.trim() ||

View File

@@ -7,7 +7,7 @@ const mangayomiSources = [{
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.wordrain69.png", "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/en.wordrain69.png",
"typeSource": "single", "typeSource": "single",
"itemType": 2, "itemType": 2,
"version": "0.0.1", "version": "0.0.2",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "novel/src/en/wordrain69.js", "pkgPath": "novel/src/en/wordrain69.js",
@@ -121,7 +121,11 @@ const mangayomiSources = [{
async getHtmlContent(url) { async getHtmlContent(url) {
const client = await new Client(); const client = await new Client();
const res = await client.get(url); const res = await client.get(url);
const doc = new Document(res.body); return await this.cleanHtmlContent(res.body);
}
async cleanHtmlContent(html) {
const doc = new Document(html);
const title = const title =
doc.selectFirst("#chapter-heading")?.text.trim() || doc.selectFirst("#chapter-heading")?.text.trim() ||
""; "";

View File

@@ -111,7 +111,11 @@ class DefaultExtension extends MProvider {
async getHtmlContent(url) { async getHtmlContent(url) {
const client = await new Client(); const client = await new Client();
const res = await client.get(url); const res = await client.get(url);
const doc = new Document(res.body); return await this.cleanHtmlContent(res.body);
}
async cleanHtmlContent(html) {
const doc = new Document(html);
const title = const title =
doc.selectFirst("div.mantine-Center-root > h1.mantine-Title-root")?.text.trim() || doc.selectFirst("div.mantine-Center-root > h1.mantine-Title-root")?.text.trim() ||
""; "";