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