From e6079ea1a8c96e89b1b2c2aa6d13c7967788ca3b Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sun, 25 Feb 2024 15:33:25 +0800 Subject: [PATCH] feat: temporarily remove html parsing --- src/lib/rsshub.ts | 10 +--------- src/lib/types.ts | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/lib/rsshub.ts b/src/lib/rsshub.ts index f38d010..723dc44 100644 --- a/src/lib/rsshub.ts +++ b/src/lib/rsshub.ts @@ -4,20 +4,12 @@ import { parse } from "tldts" import { parseRules } from "./rules" import type { RSSData, Rule } from "./types" -const parseHtml = (html) => { - const template = document.createElement('template'); - template.innerHTML = html; - return template; -} - function ruleHandler(rule: Rule, params, url, html, success, fail) { const run = () => { let resultWithParams if (typeof rule.target === "function") { try { - const template = parseHtml(html) - resultWithParams = rule.target(params, url, template.content) - template.remove() + resultWithParams = rule.target(params, url) } catch (error) { resultWithParams = "" } diff --git a/src/lib/types.ts b/src/lib/types.ts index b026435..d0c8cba 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -2,7 +2,7 @@ export type Rule = { title: string docs: string source: string[] - target: string | ((params: any, url: string, document: DocumentFragment) => string) + target: string | ((params: any, url: string) => string) } export type Rules = {