LightNovelWP: fixs for bacalighnovel (#1116)

* LightNovelWP: fix bacalighnovel

* LightNovelWP: fix novel without covers & weird names in popNovels and search (html entities)
This commit is contained in:
Justin COLLON
2024-08-06 18:25:14 +02:00
committed by GitHub
parent ecc2776425
commit f10dd1ad10
+4 -3
View File
@@ -37,7 +37,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
this.icon = `multisrc/lightnovelwp/${metadata.id.toLowerCase()}/icon.png`;
this.site = metadata.sourceSite;
const versionIncrements = metadata.options?.versionIncrements || 0;
this.version = `1.1.${2 + versionIncrements}`;
this.version = `1.1.${3 + versionIncrements}`;
this.options = metadata.options ?? ({} as LightNovelWPOptions);
this.filters = metadata.filters satisfies Filters;
}
@@ -73,6 +73,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
}
parseNovels(html: string): Plugin.NovelItem[] {
html = load(html).html(); // fix "'" beeing replaced by "’" (html entities)
const novels: Plugin.NovelItem[] = [];
const articles = html.match(/<article([\s\S]*?)<\/article>/g) || [];
@@ -82,7 +83,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
if (novelName && novelUrl) {
const novelCover =
article.match(/<img.*src="(.*?)"(?:\sdata-src="(.*?)")?.*\/>/) || [];
article.match(/<img.*src="(.*?)"(?:\sdata-src="(.*?)")?.*\/?>/) || [];
novels.push({
name: novelName,
@@ -177,7 +178,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
isReadingStatus = true;
}
// chapters
else if (attribs['class'] === 'eplister eplisterfull') {
else if (attribs['class'] && attribs['class'].includes('eplister')) {
isParsingChapterList = true;
} else if (isParsingChapterList && name === 'li') {
isReadingChapter = true;