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

@@ -84,29 +84,31 @@ async function processCreateArticle(
streamResponse.info("downloading article");
const result = await webScrape(fetchUrl, streamResponse);
const scrapeResult = await webScrape(fetchUrl, streamResponse);
log.debug("downloaded and parse parsed", result);
log.debug("downloaded and parse parsed", scrapeResult);
streamResponse.info("parsed article, creating tags with openai");
const aiMeta = await openai.extractArticleMetadata(result.markdown);
const aiMeta = await openai.extractArticleMetadata(scrapeResult.markdown);
streamResponse.info("postprocessing article");
const title = result?.title || aiMeta?.headline || "";
const title = scrapeResult?.title || aiMeta?.headline || "";
let coverImagePath: string | undefined = undefined;
if (result?.image?.length) {
log.debug("using local image for cover image", { image: result.image });
if (scrapeResult?.image?.length) {
log.debug("using local image for cover image", {
image: scrapeResult.image,
});
coverImagePath = await fetchAndStoreCover(
result.image,
scrapeResult.image,
title,
streamResponse,
);
} else {
const urlPath = await getUnsplashCoverImage(
result.markdown,
scrapeResult.markdown,
streamResponse,
);
coverImagePath = await fetchAndStoreCover(urlPath, title, streamResponse);
@@ -118,15 +120,15 @@ async function processCreateArticle(
const newArticle: ArticleResource["content"] = {
_type: "Article",
headline: title,
articleBody: result.markdown,
articleBody: scrapeResult.markdown,
url: fetchUrl,
datePublished: formatDate(
result?.published || aiMeta?.datePublished || undefined,
scrapeResult?.published || aiMeta?.datePublished || undefined,
),
image: coverImagePath,
author: {
_type: "Person",
name: (result.schemaOrgData?.author?.name || aiMeta?.author || "")
name: (scrapeResult.schemaOrgData?.author?.name || aiMeta?.author || "")
.replace(
"@",
"twitter:",