From a1b08e75a5cde508454cc6343c78ae8cb7ac9999 Mon Sep 17 00:00:00 2001 From: Danny Spina Date: Tue, 20 Jun 2023 12:59:26 +0200 Subject: [PATCH] Limit fetch to html --- index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 07d2428..41c5661 100644 --- a/index.ts +++ b/index.ts @@ -96,7 +96,9 @@ app.get("/blazed", async (req, res) => { const pageToBlaze = req.query.url as string; try { - const response = await got(pageToBlaze); + const response = await got(pageToBlaze, { + headers: { Accept: "text/html" }, + }); const { document } = parseHTML(response.body); if (!isProbablyReaderable(document)) { return res.sendFile(path.join(__dirname, "/dist/not_blazed.html"));