prague-blockchain-week/data/23/events/metaverse-festival/_sync.js

58 řádky
1.7 KiB
JavaScript
Surový Normální zobrazení Historie

2023-03-27 04:06:52 +02:00
import { Html5Entities } from "https://deno.land/x/html_entities@v1.0/mod.js";
2023-03-27 04:32:13 +02:00
const peopleMapper = {
"Adam Rajnoha": { country: "cz" },
"David Mařák": { country: "cz" },
2023-04-17 10:57:23 +02:00
"Filip Kollert": { country: "cz" },
2023-03-27 04:32:13 +02:00
"Honza Borýsek": { country: "cz" },
"Iraida Novruzova": { country: "az" },
"Inna Fetissova": { country: "cz" },
"Juraj Kováč": { country: "sk" },
"Martin Sokol": { country: "cz" },
"Natália Rajnohová": { country: "sk" },
"Olska Green": { country: "pt" },
"Ondrej T.": { country: "sk" },
2023-04-07 00:09:13 +02:00
"Pavla Julia Kolářová": { country: "cz" },
"Sara Polak": { country: "cz" },
"Thomas De Bruyne": { country: "be" },
2023-03-27 04:32:13 +02:00
"Timmu Toke": { country: "us" },
2023-04-06 23:30:15 +02:00
"Julie Šislerová": { country: "cz" },
2023-04-12 02:07:11 +02:00
"Kateřina Škarabelová": { country: "cz" },
"Matej Curda": { country: "cz" },
2023-03-27 04:32:13 +02:00
};
2023-03-27 04:06:52 +02:00
export async function data(tools) {
2023-04-07 00:09:13 +02:00
const $ = await tools.loadHtmlUrl("https://metaversefestivalprague.com/");
const out = { speakers: [] };
2023-03-27 04:32:13 +02:00
2023-04-07 00:09:13 +02:00
for (const el of $("div.elementor-col-16").toArray()) {
const name = cleanupName($("h3 span", el).html());
if (name === "Reveal Soon") {
continue;
2023-03-27 04:06:52 +02:00
}
2023-04-07 00:09:13 +02:00
const item = {
id: tools.formatId(name),
name,
caption: $("p.elementor-icon-box-description", el).text().trim(),
photoUrl: $("div.elementor-widget-container img", el).attr("src"),
};
if (peopleMapper[name]) {
Object.assign(item, peopleMapper[name]);
}
out.speakers.push(item);
2023-03-27 04:06:52 +02:00
}
2023-04-07 00:09:13 +02:00
return out;
}
function cleanupName(str) {
return Html5Entities.decode(str.trim())
.replace(/\s?<br>\s?/, " ")
.toLowerCase()
.split(" ")
.map((str) => str.charAt(0).toUpperCase() + str.slice(1))
.join(" ");
}