Skip to content

Commit fc51743

Browse files
fbontinjonasstenberg
authored andcommitted
feat: Add two forks as a restaurant
1 parent ff36822 commit fc51743

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { RestaurantMetaProps } from '@devolunch/shared';
2+
import { Page } from 'puppeteer';
3+
4+
export const meta: RestaurantMetaProps = {
5+
title: 'Two Forks',
6+
url: 'https://www.twoforks.se/lunch',
7+
imageUrl:
8+
'https://images.squarespace-cdn.com/content/v1/5c6fc5858155121249a4c49f/d9867018-aaa7-4d7c-8a5b-b5f666277406/%C2%A9jensnordstromtwoforks0027.jpg',
9+
googleMapsUrl: 'https://maps.app.goo.gl/GKATv8jSGjbAKfYt5',
10+
coordinate: {
11+
lat: 55.6073278,
12+
lon: 12.9920499,
13+
},
14+
};
15+
16+
export const browserScrapeFunction = (page: Page) =>
17+
page.evaluate(() => {
18+
const nbrs = [1, 2, 3] as const;
19+
const types = { 1: 'vegan', 2: 'vegan', 3: 'meat' } as const;
20+
21+
return nbrs.map((nbr) => {
22+
const header = [...document.querySelectorAll('h2')].find((h) => h.innerText === `NO. ${nbr}`);
23+
const title = (header?.nextElementSibling as HTMLParagraphElement)?.innerText.trim();
24+
25+
return { type: types[nbr], title };
26+
});
27+
});

0 commit comments

Comments
 (0)