Fix serp html

This commit is contained in:
Danny Spina 2023-06-19 14:11:22 +02:00
parent a58ec571e2
commit 5c676ca5b3
3 changed files with 31 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import got from "got";
import path from "path"; import path from "path";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import fetch from 'node-fetch' import fetch from 'node-fetch'
import "dotenv/config";
const app = express(); const app = express();
const port = 8888; const port = 8888;
@ -45,13 +46,23 @@ app.get("/", async (req, res) => {
<div> <div>
<h2>${result.title}</h2> <h2>${result.title}</h2>
<a href="https://ill-red-skunk-wig.cyclic.app/blazed?url=${result.url}">${result.url}</a> <a href="https://ill-red-skunk-wig.cyclic.app/blazed?url=${result.url}">${result.url}</a>
<a href="${result.url}"> <a href="https://ill-red-skunk-wig.cyclic.app/blazed?url=${result.url}">
<p>${result.description}</p> <p>${result.description}</p>
</a> </a>
</div> </div>
<hr />
`); `);
}) })
res.send(results.join('')) res.send(`<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Blaze The Page</title>
</head>
<body>
${results.join("")}
</body>
</html>`);
}) })
}) })
.catch((err) => { .catch((err) => {

17
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@mozilla/readability": "^0.4.4", "@mozilla/readability": "^0.4.4",
"dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"fetch": "^1.1.0", "fetch": "^1.1.0",
"got": "^13.0.0", "got": "^13.0.0",
@ -778,6 +779,17 @@
"url": "https://github.com/fb55/domutils?sponsor=1" "url": "https://github.com/fb55/domutils?sponsor=1"
} }
}, },
"node_modules/dotenv": {
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
"node_modules/ee-first": { "node_modules/ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -2915,6 +2927,11 @@
"domhandler": "^5.0.3" "domhandler": "^5.0.3"
} }
}, },
"dotenv": {
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
},
"ee-first": { "ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",

View File

@ -13,6 +13,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@mozilla/readability": "^0.4.4", "@mozilla/readability": "^0.4.4",
"dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"fetch": "^1.1.0", "fetch": "^1.1.0",
"got": "^13.0.0", "got": "^13.0.0",