fix: remove all linter errors

This commit is contained in:
Max Richter
2026-01-10 15:06:43 +01:00
parent e55f787a29
commit 694feb083d
20 changed files with 206 additions and 593 deletions

View File

@@ -47,7 +47,7 @@ export function absolutizeDomUrls(dom: JSDOM, domain: string): void {
document
.querySelectorAll("img[srcset], source[srcset]")
.forEach((el: HTMLImageElement) => {
.forEach((el) => {
const v = el.getAttribute("srcset");
if (!v) return;
const abs = absolutizeSrcset(v, base);
@@ -55,7 +55,7 @@ export function absolutizeDomUrls(dom: JSDOM, domain: string): void {
});
document.querySelectorAll("[style]").forEach(
(el: HTMLElement) => {
(el) => {
const v = el.getAttribute("style");
if (!v) return;
const abs = absolutizeCssUrls(v, base);
@@ -73,7 +73,7 @@ export function absolutizeDomUrls(dom: JSDOM, domain: string): void {
document
.querySelectorAll('meta[http-equiv="refresh" i][content]')
.forEach((meta: HTMLMetaElement) => {
.forEach((meta) => {
const content = meta.getAttribute("content") || "";
const abs = absolutizeMetaRefresh(content, base);
if (abs !== content) meta.setAttribute("content", abs);
@@ -168,10 +168,20 @@ function absolutizeMetaRefresh(content: string, base: string): string {
const turndownService = new TurndownService();
export interface WebScrapeResult {
title?: string;
image?: string;
published?: string;
content: string;
schemaOrgData?: { author?: { name?: string } };
markdown: string;
dom: JSDOM["window"]["document"];
}
export async function webScrape(
url: string,
streamResponse: ReturnType<typeof createStreamResponse>,
): JSDOM {
) {
const u = new URL(url);
const html = await fetchHtmlWithPlaywright(url, streamResponse);
const dom = new JSDOM(html);