diff --git a/package-lock.json b/package-lock.json index a18ba24..8ce5347 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 6f3f68a..87583ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "txtdot", - "version": "1.0.0", + "version": "1.1.1", "private": true, "description": "", "main": "dist/app.js", diff --git a/src/handlers/google.ts b/src/handlers/google.ts index 17c6df2..8501652 100644 --- a/src/handlers/google.ts +++ b/src/handlers/google.ts @@ -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; }