From 2f066a71e2d6ccce86480bd11d5e38f3192c2beb Mon Sep 17 00:00:00 2001 From: Victor Fernandes Date: Wed, 10 Jan 2024 22:30:38 +0000 Subject: [PATCH] feat: add google.com/maps --- src/background.ts | 15 +++++++++++++++ src/utils/copy.ts | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/background.ts b/src/background.ts index e889e807..ad6cd260 100644 --- a/src/background.ts +++ b/src/background.ts @@ -209,6 +209,21 @@ function getScrapperOptionsByUrl(url: string, title: string) { } } + if (url.includes('google.com/maps/search')) { + return { + header: title, + listElementsQuery: '[role="feed"] [jsaction*="mouseover"]', + elementParser: [ + { title: 'Image', query: 'img', type: 'image' }, + { title: 'Name', query: 'a', type: 'get-attribute', attribute: 'aria-label' }, + { title: 'Rating', query: 'span[role="img"]', type: 'get-attribute', attribute: 'aria-label'}, + { title: 'Link', query: 'a', type: 'clean-url' } + ] + } + } + + // + return null; } diff --git a/src/utils/copy.ts b/src/utils/copy.ts index 84b8b95b..33779f75 100644 --- a/src/utils/copy.ts +++ b/src/utils/copy.ts @@ -6,6 +6,8 @@ export function hasImage(cell: any) { return cell.startsWith('http') && ( cell.toLowerCase().includes('/image/') || cell.toLowerCase().includes('/images/') + || cell.toLowerCase().includes('thumbnail') + || cell.includes('googleusercontent.com/p/') || ( cell.includes('.jpg') || cell.includes('.jpeg')