Formatting

This commit is contained in:
2025-06-28 00:15:51 +02:00
parent 0088b8f02a
commit 4ac986745d
22 changed files with 1180 additions and 1245 deletions

View File

@@ -1,12 +1,12 @@
export async function getWebsiteTitle(url: string): Promise<string | null> {
const res = await fetch(url, { redirect: 'follow' })
const res = await fetch(url, { redirect: "follow" })
if (!res.ok) {
return null
}
const contentType = res.headers.get('content-type')
if (!contentType || !contentType.includes('text/html')) {
const contentType = res.headers.get("content-type")
if (!contentType || !contentType.includes("text/html")) {
return null
}
@@ -16,16 +16,16 @@ export async function getWebsiteTitle(url: string): Promise<string | null> {
if (titleMatch && titleMatch[1]) {
const title = titleMatch[1]
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&amp;/g, '&')
.replace(/&quot;/g, '"')
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&amp;/g, "&")
.replace(/&quot;/g, "\"")
.replace(/&#39;/g, "'")
.replace(/&nbsp;/g, ' ')
.replace(/&nbsp;/g, " ")
.trim()
return title || null
}
return null
}
}