This commit is contained in:
13
cli.mjs
13
cli.mjs
@@ -94,16 +94,21 @@ async function menickoMamafoodbistro(){
|
||||
const { document }= await fetchHTML(url);
|
||||
const menicko= document.querySelectorAll("section")[2].getElementsByClassName("sqs-html-content")[1];
|
||||
const dny= {};
|
||||
for(const den of menicko.getElementsByTagName("h4")){
|
||||
const section= el=> el.getElementsByClassName("sqsrte-text-color--accent");
|
||||
const textContent= el=> {
|
||||
el.getElementsByTagName("strong")[0].remove();
|
||||
return el.textContent.trim();
|
||||
};
|
||||
for(const den of Array.from(section(menicko)).map(el=> el.parentElement)){
|
||||
const polevka= den.nextElementSibling;
|
||||
if(!polevka) break;
|
||||
let hi= polevka;
|
||||
const hlavni= [];
|
||||
while(( hi= hi.nextElementSibling ) && hi.tagName !== "H4")
|
||||
while(( hi= hi.nextElementSibling ) && section(hi).length===0)
|
||||
hlavni.push(hi);
|
||||
Reflect.set(dny, den.textContent.trim().toLowerCase(), {
|
||||
polevky: [ polevka.textContent ],
|
||||
hlavni: hlavni.map(el=> el.textContent),
|
||||
polevky: [ textContent(polevka) ],
|
||||
hlavni: hlavni.map(textContent),
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user