Skip to content

Commit

Permalink
feat: add yelp
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Fernandes committed Jan 10, 2024
1 parent 36910a9 commit 2452e03
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,38 @@ function getScrapperOptionsByUrl(url: string, title: string) {
}
}

if (url.includes('yellowpages.com/search')) {
return {
header: title,
listElementsQuery: '.result',
elementParser: [
{ title: 'Logo', query: 'img', type: 'image' },
{ title: 'Name', query: '.business-name', type: 'text' },
{ title: 'Phone number', query: '.phone', type: 'text' },
{ title: 'Address', query: '.adr', type: 'text' },
{ title: 'Categories', query: '.categories', type: 'text' },
{ title: 'Website', query: '.track-visit-website', type: 'link' }
]
}
}

if (url.includes('yelp.com/search')) {
return {
header: title,
listElementsQuery: '[data-testid="serp-ia-card"]',
elementParser: [
{ title: 'Image', query: 'img', type: 'image' },
{ title: 'Name', query: '[class*="businessName_"]', type: 'text' },
{ title: 'Rating', query: 'span[data-font-weight="semibold"]', type: 'text' },
{ title: 'Categories', query: '[class*="priceCategory"]', type: 'text' },
{ title: 'Yelp link', query: '[class*="businessName_"] a', type: 'clean-url' }
]
}
}


//

return null;
}

Expand Down
3 changes: 2 additions & 1 deletion src/utils/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export function hasImage(cell: any) {
}

return cell.startsWith('http') && (
cell.includes('/image/')
cell.toLowerCase().includes('/image/')
|| cell.toLowerCase().includes('/images/')
|| (
cell.includes('.jpg')
|| cell.includes('.jpeg')
Expand Down

0 comments on commit 2452e03

Please sign in to comment.