fix: google results

This commit is contained in:
Artemy 2023-08-18 11:09:02 +03:00
parent 944e42e857
commit 87cba82ee6
3 changed files with 9 additions and 9 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "txtdot",
"version": "1.0.0",
"version": "1.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "txtdot",
"version": "1.0.0",
"version": "1.1.1",
"license": "MIT",
"dependencies": {
"@fastify/static": "^6.10.2",

View File

@ -1,6 +1,6 @@
{
"name": "txtdot",
"version": "1.0.0",
"version": "1.1.1",
"private": true,
"description": "",
"main": "dist/app.js",

View File

@ -10,15 +10,15 @@ export default async function google(
] as HTMLAnchorElement[];
const googleNames = [...window.document.querySelectorAll(".VuuXrf")];
const results = googleAnchors.map(
(a: HTMLAnchorElement, i: number): GoogleProps => {
const results = googleAnchors
.map((a: HTMLAnchorElement, i: number): GoogleProps => {
return {
href: a.href!,
siteName: googleNames[i].textContent!,
heading: a.childNodes[1].textContent!,
heading: a.childNodes[1]?.textContent,
};
}
);
})
.filter((a) => a.heading);
if (!googleAnchors) {
throw new EngineParseError(
@ -90,5 +90,5 @@ export default async function google(
interface GoogleProps {
href: string;
siteName: string;
heading: string;
heading: string | null;
}