diff --git a/server/src/chefie.ts b/server/src/chefie.ts index a9932c0..fd9657e 100644 --- a/server/src/chefie.ts +++ b/server/src/chefie.ts @@ -1,10 +1,11 @@ -import $ from 'cheerio'; import os from 'os'; import path from 'path'; import fs from 'fs'; import axios from 'axios'; +import { load } from 'cheerio'; import { formatDate } from './utils'; +// TODO přesunout do types type PizzaSize = { varId: number, size: string, @@ -13,6 +14,7 @@ type PizzaSize = { price: number } +// TODO přesunout do types type Pizza = { name: string, ingredients: string[], @@ -41,7 +43,8 @@ const boxPrices: { [key: string]: number } = { const downloadPizzy = async () => { // Získáme seznam pizz const html = await axios.get(pizzyUrl).then(res => res.data); - const links = $('.vypisproduktu > div > h4 > a', html) + const $ = load(html); + const links = $('.vypisproduktu > div > h4 > a'); const urls = []; for (let i = 0; i < links.length; i++) { if (links[i].name === 'a' && links[i].attribs?.href) {