From 0d6020d1a0037498126d92018e45c630e0244fc2 Mon Sep 17 00:00:00 2001 From: Martin Berka Date: Sun, 18 Jun 2023 18:05:03 +0200 Subject: [PATCH] =?UTF-8?q?Oprava=20deprecated=20pou=C5=BEit=C3=AD=20Cheer?= =?UTF-8?q?io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/chefie.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) {