Fix: lightnovelpub + lightnovelworld replaced ; with + (#818)
* replaced ; with + * changed version
This commit is contained in:
@@ -7,7 +7,7 @@ import dayjs from "dayjs";
|
|||||||
class LightNovelPub implements Plugin.PagePlugin {
|
class LightNovelPub implements Plugin.PagePlugin {
|
||||||
id = "lightnovelpub";
|
id = "lightnovelpub";
|
||||||
name = "LightNovelPub";
|
name = "LightNovelPub";
|
||||||
version = "1.0.0";
|
version = "1.0.1";
|
||||||
icon = "src/en/lightnovelpub/icon.png";
|
icon = "src/en/lightnovelpub/icon.png";
|
||||||
site = "https://www.lightnovelpub.com/";
|
site = "https://www.lightnovelpub.com/";
|
||||||
headers = {
|
headers = {
|
||||||
@@ -58,25 +58,25 @@ class LightNovelPub implements Plugin.PagePlugin {
|
|||||||
return novels;
|
return novels;
|
||||||
}
|
}
|
||||||
|
|
||||||
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel & {totalPages: number}> {
|
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel & { totalPages: number }> {
|
||||||
const body = await fetchApi(this.site + novelPath).then((r) => r.text());
|
const body = await fetchApi(this.site + novelPath).then((r) => r.text());
|
||||||
|
|
||||||
const loadedCheerio = parseHTML(body);
|
const loadedCheerio = parseHTML(body);
|
||||||
const totalChapters = parseInt(loadedCheerio(".header-stats span:first strong").text(), 10);
|
const totalChapters = parseInt(loadedCheerio(".header-stats span:first strong").text(), 10);
|
||||||
|
|
||||||
const novel: Plugin.SourceNovel & {totalPages: number}= {
|
const novel: Plugin.SourceNovel & { totalPages: number } = {
|
||||||
path: novelPath,
|
path: novelPath,
|
||||||
name: loadedCheerio("h1.novel-title").text().trim() || "Untitled",
|
name: loadedCheerio("h1.novel-title").text().trim() || "Untitled",
|
||||||
cover: loadedCheerio("figure.cover > img").attr("data-src"),
|
cover: loadedCheerio("figure.cover > img").attr("data-src"),
|
||||||
author: loadedCheerio(".author > a > span").text(),
|
author: loadedCheerio(".author > a > span").text(),
|
||||||
summary: loadedCheerio(".summary > .content").text().trim(),
|
summary: loadedCheerio(".summary > .content").text().trim(),
|
||||||
status: loadedCheerio(".header-stats span:last strong").text(),
|
status: loadedCheerio(".header-stats span:last strong").text(),
|
||||||
totalPages: Math.ceil(totalChapters/100),
|
totalPages: Math.ceil(totalChapters / 100),
|
||||||
chapters: [],
|
chapters: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
novel.genres = loadedCheerio('.categories ul li')
|
novel.genres = loadedCheerio('.categories ul li')
|
||||||
.map((a,ex) => loadedCheerio(ex).text().trim())
|
.map((a, ex) => loadedCheerio(ex).text().trim())
|
||||||
.toArray()
|
.toArray()
|
||||||
.join(',');
|
.join(',');
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@ class LightNovelPub implements Plugin.PagePlugin {
|
|||||||
const chapter: Plugin.ChapterItem[] = [];
|
const chapter: Plugin.ChapterItem[] = [];
|
||||||
loadedCheerio('.chapter-list li').each(function () {
|
loadedCheerio('.chapter-list li').each(function () {
|
||||||
const chapterName =
|
const chapterName =
|
||||||
'Chapter ' +
|
'Chapter ' +
|
||||||
loadedCheerio(this).find('.chapter-no').text().trim() +
|
loadedCheerio(this).find('.chapter-no').text().trim() +
|
||||||
' - ';
|
' - ' +
|
||||||
loadedCheerio(this).find('.chapter-title').text().trim();
|
loadedCheerio(this).find('.chapter-title').text().trim();
|
||||||
|
|
||||||
const releaseDate = loadedCheerio(this)
|
const releaseDate = loadedCheerio(this)
|
||||||
.find('.chapter-update')
|
.find('.chapter-update')
|
||||||
.attr('datetime');
|
.attr('datetime');
|
||||||
|
|
||||||
const chapterUrl = loadedCheerio(this).find('a').attr('href')?.substring(1);
|
const chapterUrl = loadedCheerio(this).find('a').attr('href')?.substring(1);
|
||||||
if (!chapterUrl) return;
|
if (!chapterUrl) return;
|
||||||
@@ -106,9 +106,10 @@ class LightNovelPub implements Plugin.PagePlugin {
|
|||||||
name: chapterName,
|
name: chapterName,
|
||||||
path: chapterUrl,
|
path: chapterUrl,
|
||||||
releaseTime: dayjs(releaseDate).toISOString(),
|
releaseTime: dayjs(releaseDate).toISOString(),
|
||||||
})});
|
})
|
||||||
|
});
|
||||||
const chapters = chapter;
|
const chapters = chapter;
|
||||||
return {chapters};
|
return { chapters };
|
||||||
}
|
}
|
||||||
|
|
||||||
async parseChapter(chapterPath: string): Promise<string> {
|
async parseChapter(chapterPath: string): Promise<string> {
|
||||||
@@ -167,7 +168,7 @@ class LightNovelPub implements Plugin.PagePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchImage(url: string): Promise<string | undefined> {
|
async fetchImage(url: string): Promise<string | undefined> {
|
||||||
return fetchFile(url, {headers: this.headers});
|
return fetchFile(url, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class LightNovelWorld implements Plugin.PagePlugin {
|
|||||||
id = "lightnovelworld";
|
id = "lightnovelworld";
|
||||||
name = "LightNovelWorld";
|
name = "LightNovelWorld";
|
||||||
site = "https://www.webnovelworld.org/";
|
site = "https://www.webnovelworld.org/";
|
||||||
version = "1.0.0";
|
version = "1.0.1";
|
||||||
icon = "src/en/lightnovelworld/icon.png";
|
icon = "src/en/lightnovelworld/icon.png";
|
||||||
headers = {
|
headers = {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
@@ -58,25 +58,25 @@ class LightNovelWorld implements Plugin.PagePlugin {
|
|||||||
return novels;
|
return novels;
|
||||||
}
|
}
|
||||||
|
|
||||||
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel & {totalPages: number}> {
|
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel & { totalPages: number }> {
|
||||||
const body = await fetchApi(this.site + novelPath).then((r) => r.text());
|
const body = await fetchApi(this.site + novelPath).then((r) => r.text());
|
||||||
|
|
||||||
const loadedCheerio = parseHTML(body);
|
const loadedCheerio = parseHTML(body);
|
||||||
const totalChapters = parseInt(loadedCheerio(".header-stats span:first strong").text(), 10);
|
const totalChapters = parseInt(loadedCheerio(".header-stats span:first strong").text(), 10);
|
||||||
|
|
||||||
const novel: Plugin.SourceNovel & {totalPages: number}= {
|
const novel: Plugin.SourceNovel & { totalPages: number } = {
|
||||||
path: novelPath,
|
path: novelPath,
|
||||||
name: loadedCheerio("h1.novel-title").text().trim() || "Untitled",
|
name: loadedCheerio("h1.novel-title").text().trim() || "Untitled",
|
||||||
cover: loadedCheerio("figure.cover > img").attr("data-src"),
|
cover: loadedCheerio("figure.cover > img").attr("data-src"),
|
||||||
author: loadedCheerio(".author > a > span").text(),
|
author: loadedCheerio(".author > a > span").text(),
|
||||||
summary: loadedCheerio(".summary > .content").text().trim(),
|
summary: loadedCheerio(".summary > .content").text().trim(),
|
||||||
status: loadedCheerio(".header-stats span:last strong").text(),
|
status: loadedCheerio(".header-stats span:last strong").text(),
|
||||||
totalPages: Math.ceil(totalChapters/100),
|
totalPages: Math.ceil(totalChapters / 100),
|
||||||
chapters: [],
|
chapters: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
novel.genres = loadedCheerio('.categories ul li')
|
novel.genres = loadedCheerio('.categories ul li')
|
||||||
.map((a,ex) => loadedCheerio(ex).text().trim())
|
.map((a, ex) => loadedCheerio(ex).text().trim())
|
||||||
.toArray()
|
.toArray()
|
||||||
.join(',');
|
.join(',');
|
||||||
|
|
||||||
@@ -90,14 +90,14 @@ class LightNovelWorld implements Plugin.PagePlugin {
|
|||||||
const chapter: Plugin.ChapterItem[] = [];
|
const chapter: Plugin.ChapterItem[] = [];
|
||||||
loadedCheerio('.chapter-list li').each(function () {
|
loadedCheerio('.chapter-list li').each(function () {
|
||||||
const chapterName =
|
const chapterName =
|
||||||
'Chapter ' +
|
'Chapter ' +
|
||||||
loadedCheerio(this).find('.chapter-no').text().trim() +
|
loadedCheerio(this).find('.chapter-no').text().trim() +
|
||||||
' - ';
|
' - ' +
|
||||||
loadedCheerio(this).find('.chapter-title').text().trim();
|
loadedCheerio(this).find('.chapter-title').text().trim();
|
||||||
|
|
||||||
const releaseDate = loadedCheerio(this)
|
const releaseDate = loadedCheerio(this)
|
||||||
.find('.chapter-update')
|
.find('.chapter-update')
|
||||||
.attr('datetime');
|
.attr('datetime');
|
||||||
|
|
||||||
const chapterUrl = loadedCheerio(this).find('a').attr('href')?.substring(1);
|
const chapterUrl = loadedCheerio(this).find('a').attr('href')?.substring(1);
|
||||||
if (!chapterUrl) return;
|
if (!chapterUrl) return;
|
||||||
@@ -106,9 +106,10 @@ class LightNovelWorld implements Plugin.PagePlugin {
|
|||||||
name: chapterName,
|
name: chapterName,
|
||||||
path: chapterUrl,
|
path: chapterUrl,
|
||||||
releaseTime: dayjs(releaseDate).toISOString(),
|
releaseTime: dayjs(releaseDate).toISOString(),
|
||||||
})});
|
})
|
||||||
|
});
|
||||||
const chapters = chapter;
|
const chapters = chapter;
|
||||||
return {chapters};
|
return { chapters };
|
||||||
}
|
}
|
||||||
|
|
||||||
async parseChapter(chapterPath: string): Promise<string> {
|
async parseChapter(chapterPath: string): Promise<string> {
|
||||||
@@ -167,7 +168,7 @@ class LightNovelWorld implements Plugin.PagePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchImage(url: string): Promise<string | undefined> {
|
async fetchImage(url: string): Promise<string | undefined> {
|
||||||
return fetchFile(url, {headers: this.headers});
|
return fetchFile(url, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
|
|||||||
Reference in New Issue
Block a user