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:
@@ -37,7 +37,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
|
|||||||
this.icon = `multisrc/lightnovelwp/${metadata.id.toLowerCase()}/icon.png`;
|
this.icon = `multisrc/lightnovelwp/${metadata.id.toLowerCase()}/icon.png`;
|
||||||
this.site = metadata.sourceSite;
|
this.site = metadata.sourceSite;
|
||||||
const versionIncrements = metadata.options?.versionIncrements || 0;
|
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.options = metadata.options ?? ({} as LightNovelWPOptions);
|
||||||
this.filters = metadata.filters satisfies Filters;
|
this.filters = metadata.filters satisfies Filters;
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parseNovels(html: string): Plugin.NovelItem[] {
|
parseNovels(html: string): Plugin.NovelItem[] {
|
||||||
|
html = load(html).html(); // fix "'" beeing replaced by "’" (html entities)
|
||||||
const novels: Plugin.NovelItem[] = [];
|
const novels: Plugin.NovelItem[] = [];
|
||||||
|
|
||||||
const articles = html.match(/<article([\s\S]*?)<\/article>/g) || [];
|
const articles = html.match(/<article([\s\S]*?)<\/article>/g) || [];
|
||||||
@@ -82,7 +83,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
|
|||||||
|
|
||||||
if (novelName && novelUrl) {
|
if (novelName && novelUrl) {
|
||||||
const novelCover =
|
const novelCover =
|
||||||
article.match(/<img.*src="(.*?)"(?:\sdata-src="(.*?)")?.*\/>/) || [];
|
article.match(/<img.*src="(.*?)"(?:\sdata-src="(.*?)")?.*\/?>/) || [];
|
||||||
|
|
||||||
novels.push({
|
novels.push({
|
||||||
name: novelName,
|
name: novelName,
|
||||||
@@ -177,7 +178,7 @@ class LightNovelWPPlugin implements Plugin.PluginBase {
|
|||||||
isReadingStatus = true;
|
isReadingStatus = true;
|
||||||
}
|
}
|
||||||
// chapters
|
// chapters
|
||||||
else if (attribs['class'] === 'eplister eplisterfull') {
|
else if (attribs['class'] && attribs['class'].includes('eplister')) {
|
||||||
isParsingChapterList = true;
|
isParsingChapterList = true;
|
||||||
} else if (isParsingChapterList && name === 'li') {
|
} else if (isParsingChapterList && name === 'li') {
|
||||||
isReadingChapter = true;
|
isReadingChapter = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user