RoyalRoad: Fix search and chapter fetch (#1618)
* urlsearchparams and regex fix * increment version number
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.3';
|
version = '2.1.4';
|
||||||
icon = 'src/en/royalroad/icon.png';
|
icon = 'src/en/royalroad/icon.png';
|
||||||
site = 'https://www.royalroad.com/';
|
site = 'https://www.royalroad.com/';
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class RoyalRoad implements Plugin.PluginBase {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onclosetag(name) {
|
onclosetag(name) {
|
||||||
if (name === 'h2') {
|
if (name === 'i') {
|
||||||
isNovelName = false;
|
isNovelName = false;
|
||||||
isParsingNovel = false;
|
isParsingNovel = false;
|
||||||
}
|
}
|
||||||
@@ -236,7 +236,7 @@ class RoyalRoad implements Plugin.PluginBase {
|
|||||||
const regexPatterns: RegExp[] = [
|
const regexPatterns: RegExp[] = [
|
||||||
/<style>\n\s+.(.+?){[^]+?display: none;/,
|
/<style>\n\s+.(.+?){[^]+?display: none;/,
|
||||||
/(<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-/,
|
||||||
/(<\/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/,
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -258,7 +258,12 @@ class RoyalRoad implements Plugin.PluginBase {
|
|||||||
searchTerm: string,
|
searchTerm: string,
|
||||||
page: number,
|
page: number,
|
||||||
): Promise<Plugin.NovelItem[]> {
|
): Promise<Plugin.NovelItem[]> {
|
||||||
const searchUrl = `${this.site}fictions/search?page=${page}&title=${encodeURIComponent(searchTerm)}`;
|
const params = new URLSearchParams({
|
||||||
|
page: page.toString(),
|
||||||
|
title: searchTerm,
|
||||||
|
globalFilters: 'true',
|
||||||
|
});
|
||||||
|
const searchUrl = `${this.site}fictions/search?${params.toString()}`;
|
||||||
|
|
||||||
const body = await fetchApi(searchUrl).then(r => r.text());
|
const body = await fetchApi(searchUrl).then(r => r.text());
|
||||||
return this.parseNovels(body);
|
return this.parseNovels(body);
|
||||||
|
|||||||
Reference in New Issue
Block a user