From 88d1f1255b4d3135426f5c9284abe7fb56931a53 Mon Sep 17 00:00:00 2001 From: Saksham Shekher <95137948+OshekharO@users.noreply.github.com> Date: Sat, 14 Oct 2023 20:41:15 +0530 Subject: [PATCH] Fix watch RoyalRoad --- repo/royalroad.com.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/repo/royalroad.com.js b/repo/royalroad.com.js index dc90e98..67fa083 100644 --- a/repo/royalroad.com.js +++ b/repo/royalroad.com.js @@ -1,6 +1,6 @@ // ==MiruExtension== // @name RoyalRoad -// @version v0.0.1 +// @version v0.0.2 // @author appdevelpo // @lang en // @license MIT @@ -70,20 +70,23 @@ export default class Biquge extends Extension { } async watch(url) { + const res = await this.request(url); + const content = res.match(/
[^&]+?<\/p>/g); + const new_content = []; - const res = await this.request(url); - const content = res.match(/
[^&]+?<\/p>/g); - const new_content = []; + if (content) { content.forEach((e) => { - e = e.replace(/<.+?>/g,""); + e = e.replace(/<.+?>/g, ""); console.log(e); - new_content.push(e) - }) - const title = res.match(/>(.+?)<\/h1>/)[0] - return { - content:new_content, - title, - } + new_content.push(e); + }); } + const title = res.match(/>(.+?)<\/h1>/)[0]; + return { + content: new_content, + title, + }; +} + }