fix: google results
This commit is contained in:
parent
944e42e857
commit
87cba82ee6
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "txtdot",
|
"name": "txtdot",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "txtdot",
|
"name": "txtdot",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/static": "^6.10.2",
|
"@fastify/static": "^6.10.2",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "txtdot",
|
"name": "txtdot",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/app.js",
|
"main": "dist/app.js",
|
||||||
|
@ -10,15 +10,15 @@ export default async function google(
|
|||||||
] as HTMLAnchorElement[];
|
] as HTMLAnchorElement[];
|
||||||
const googleNames = [...window.document.querySelectorAll(".VuuXrf")];
|
const googleNames = [...window.document.querySelectorAll(".VuuXrf")];
|
||||||
|
|
||||||
const results = googleAnchors.map(
|
const results = googleAnchors
|
||||||
(a: HTMLAnchorElement, i: number): GoogleProps => {
|
.map((a: HTMLAnchorElement, i: number): GoogleProps => {
|
||||||
return {
|
return {
|
||||||
href: a.href!,
|
href: a.href!,
|
||||||
siteName: googleNames[i].textContent!,
|
siteName: googleNames[i].textContent!,
|
||||||
heading: a.childNodes[1].textContent!,
|
heading: a.childNodes[1]?.textContent,
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
);
|
.filter((a) => a.heading);
|
||||||
|
|
||||||
if (!googleAnchors) {
|
if (!googleAnchors) {
|
||||||
throw new EngineParseError(
|
throw new EngineParseError(
|
||||||
@ -90,5 +90,5 @@ export default async function google(
|
|||||||
interface GoogleProps {
|
interface GoogleProps {
|
||||||
href: string;
|
href: string;
|
||||||
siteName: string;
|
siteName: string;
|
||||||
heading: string;
|
heading: string | null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user