🐛 Fixes missing element for Cukrovarka
All checks were successful
Update menicka / update-rss (push) Successful in 5m13s

This commit is contained in:
2024-11-28 10:02:46 +01:00
parent 99a2ad2636
commit f98615695a
4 changed files with 24 additions and 6 deletions

View File

@ -14,7 +14,7 @@ $.api()
if(is_git) s.run`git pull --rebase`;
const menicka= await Promise.allSettled([ menickoCukrovarka(), menickoGlobus(), menickoMamafoodbistro() ])
.then(results=> results.filter(p=> p.status!=="rejected").map(p=> p.value));
.then(results=> results.filter(p=> p.status!=="rejected" ? true : (echo(p), false)).map(p=> p.value));
const days= [ "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota", "neděle" ];
const out_head= description+"\n\n" + days.map((v)=> `[${v}](#${v})`).join(" · "); // anchors for days
let out= "";
@ -112,7 +112,7 @@ async function menickoMamafoodbistro(){
async function menickoCukrovarka(){
const url= "https://www.menicka.cz/api/iframe/?id=8542&continuous=true";
const { document }= await fetchHTML(url);
const food= el=> el.getElementsByClassName("food")[0].textContent;
const food= el=> !el ? "—" : el.getElementsByClassName("food")[0].textContent;
const dny= {};
for(const den of document.getElementsByClassName("content")){
let name= den.getElementsByTagName("h2")[0].textContent.trim();