added an extra environment variable

This commit is contained in:
daniel31x13
2023-12-31 10:46:09 -05:00
parent 29e0370808
commit 4e29330472
7 changed files with 40 additions and 5 deletions
+10 -1
View File
@@ -1,6 +1,15 @@
import fetch from "node-fetch";
import https from "https";
export default async function getTitle(url: string) {
try {
const response = await fetch(url);
const httpsAgent = new https.Agent({
rejectUnauthorized:
process.env.IGNORE_UNAUTHORIZED_CA === "true" ? false : true,
});
const response = await fetch(url, {
agent: httpsAgent,
});
const text = await response.text();
// regular expression to find the <title> tag