mirror of
https://github.com/cupcakearmy/blaze.git
synced 2024-12-22 16:26:26 +00:00
Limit fetch to html
This commit is contained in:
parent
1cc669fb54
commit
a1b08e75a5
4
index.ts
4
index.ts
@ -96,7 +96,9 @@ app.get("/blazed", async (req, res) => {
|
|||||||
const pageToBlaze = req.query.url as string;
|
const pageToBlaze = req.query.url as string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await got(pageToBlaze);
|
const response = await got(pageToBlaze, {
|
||||||
|
headers: { Accept: "text/html" },
|
||||||
|
});
|
||||||
const { document } = parseHTML(response.body);
|
const { document } = parseHTML(response.body);
|
||||||
if (!isProbablyReaderable(document)) {
|
if (!isProbablyReaderable(document)) {
|
||||||
return res.sendFile(path.join(__dirname, "/dist/not_blazed.html"));
|
return res.sendFile(path.join(__dirname, "/dist/not_blazed.html"));
|
||||||
|
Loading…
Reference in New Issue
Block a user