cleanup: RoyalRoad chapter (#1133)
This commit is contained in:
@@ -7,7 +7,7 @@ import { NovelStatus } from '@libs/novelStatus';
|
|||||||
class RoyalRoad implements Plugin.PluginBase {
|
class RoyalRoad implements Plugin.PluginBase {
|
||||||
id = 'royalroad';
|
id = 'royalroad';
|
||||||
name = 'Royal Road';
|
name = 'Royal Road';
|
||||||
version = '2.1.0';
|
version = '2.1.1';
|
||||||
icon = 'src/en/royalroad/icon.png';
|
icon = 'src/en/royalroad/icon.png';
|
||||||
site = 'https://www.royalroad.com/';
|
site = 'https://www.royalroad.com/';
|
||||||
|
|
||||||
@@ -234,6 +234,7 @@ class RoyalRoad implements Plugin.PluginBase {
|
|||||||
const html = await result.text();
|
const html = await result.text();
|
||||||
const parts: string[] = [];
|
const parts: string[] = [];
|
||||||
const regexPatterns: RegExp[] = [
|
const regexPatterns: RegExp[] = [
|
||||||
|
/<style>\n\s+.(.+?){[^]+speak: never;/,
|
||||||
/(<div class="portlet solid author-note-portlet"[^]+)<div class="margin-bottom-20/,
|
/(<div class="portlet solid author-note-portlet"[^]+)<div class="margin-bottom-20/,
|
||||||
/(<div class="chapter-inner chapter-content"[^]+)<div class="portlet light t-center-3/,
|
/(<div class="chapter-inner chapter-content"[^]+)<div class="portlet light t-center-3/,
|
||||||
/(<\/div>\s+<div class="portlet solid author-note-portlet"[^]+)<div class="row margin-bottom-10/,
|
/(<\/div>\s+<div class="portlet solid author-note-portlet"[^]+)<div class="row margin-bottom-10/,
|
||||||
@@ -246,8 +247,11 @@ class RoyalRoad implements Plugin.PluginBase {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
extractContent(regexPatterns);
|
extractContent(regexPatterns);
|
||||||
const chapterText = parts.join('<hr>');
|
const cleanup = new RegExp(`<p class=\"${parts[0]}.+?<\/p>`, 'g');
|
||||||
return chapterText;
|
const chapterText = parts.slice(1).join('<hr>');
|
||||||
|
return chapterText
|
||||||
|
.replace(cleanup, '')
|
||||||
|
.replace(/<p class=\"[^><]+>/g, '<p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
async searchNovels(
|
async searchNovels(
|
||||||
|
|||||||
Reference in New Issue
Block a user