fix: remove all linter errors
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user