Skip to content

Commit 2452e03

Browse files
author
Victor Fernandes
committed
feat: add yelp
1 parent 36910a9 commit 2452e03

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Diff for: src/background.ts

+32
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,38 @@ function getScrapperOptionsByUrl(url: string, title: string) {
148148
}
149149
}
150150

151+
if (url.includes('yellowpages.com/search')) {
152+
return {
153+
header: title,
154+
listElementsQuery: '.result',
155+
elementParser: [
156+
{ title: 'Logo', query: 'img', type: 'image' },
157+
{ title: 'Name', query: '.business-name', type: 'text' },
158+
{ title: 'Phone number', query: '.phone', type: 'text' },
159+
{ title: 'Address', query: '.adr', type: 'text' },
160+
{ title: 'Categories', query: '.categories', type: 'text' },
161+
{ title: 'Website', query: '.track-visit-website', type: 'link' }
162+
]
163+
}
164+
}
165+
166+
if (url.includes('yelp.com/search')) {
167+
return {
168+
header: title,
169+
listElementsQuery: '[data-testid="serp-ia-card"]',
170+
elementParser: [
171+
{ title: 'Image', query: 'img', type: 'image' },
172+
{ title: 'Name', query: '[class*="businessName_"]', type: 'text' },
173+
{ title: 'Rating', query: 'span[data-font-weight="semibold"]', type: 'text' },
174+
{ title: 'Categories', query: '[class*="priceCategory"]', type: 'text' },
175+
{ title: 'Yelp link', query: '[class*="businessName_"] a', type: 'clean-url' }
176+
]
177+
}
178+
}
179+
180+
181+
//
182+
151183
return null;
152184
}
153185

Diff for: src/utils/copy.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ export function hasImage(cell: any) {
44
}
55

66
return cell.startsWith('http') && (
7-
cell.includes('/image/')
7+
cell.toLowerCase().includes('/image/')
8+
|| cell.toLowerCase().includes('/images/')
89
|| (
910
cell.includes('.jpg')
1011
|| cell.includes('.jpeg')

0 commit comments

Comments
 (0)