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