prague-blockchain-week/data/23/events/reg3/_sync.js

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

2023-05-04 21:12:54 +02:00
const peopleMapper = {
"Ondřej Kovařík": { country: "cz" },
2023-05-09 16:59:51 +02:00
"František Vinopal": { country: "cz" },
2023-05-13 21:37:15 +02:00
"Tomáš Olexa": { country: "cz" },
2023-05-15 13:15:29 +02:00
"Ondřej Dusílek": { country: "cz" },
2023-05-16 13:16:40 +02:00
"Dalibor Černý": { country: "cz" },
"Michal Matějka": { country: "cz" },
"Jakub Tesař": { country: "cz" },
2023-05-18 23:12:50 +02:00
"Štěpán Kouba": { country: "cz" },
2023-05-19 18:03:40 +02:00
"David Stancel": { country: "sk" },
"Štěpán Kouba": { country: "cz" },
2023-05-22 08:32:50 +02:00
"Lukáš Kovanda": { country: "cz" },
"Radek Švarz": { country: "cz" },
2023-05-25 09:59:31 +02:00
"Roman Valihrach": { country: "cz" },
2023-05-30 13:03:58 +02:00
"Anett Rolikova": { country: "sk" },
"Viktor Koliba": { country: "cz" },
2023-05-04 21:12:54 +02:00
};
export async function data(tools) {
const $ = await tools.loadHtmlUrl("https://prague.reg3.eu/speakers");
const out = { speakers: [] };
2023-05-20 00:11:07 +02:00
for (const el of $('div.section.speakers div[role="listitem"]').toArray()) {
const name = $("h2", el).text();
2023-05-04 21:12:54 +02:00
const item = {
id: tools.formatId(name),
name,
2023-05-20 00:11:07 +02:00
caption: $("h3", el).toArray().map((x, i) => {
2023-05-19 19:28:41 +02:00
let t = $(x).text().trim()
if (!t.match(/^at /) && i !== 0) {
t = (', ' + t)
} else {
t = ' ' + t
}
return t
}).join("").trim(),
2023-05-04 21:12:54 +02:00
twitter: $('a[href^="https://twitter.com"]', el).attr("href")?.replace(
"https://twitter.com/",
"",
),
2023-05-19 19:28:41 +02:00
linkedin: $('a[href^="https://www.linkedin.com/in/"]', el).attr("href")?.replace(
"https://www.linkedin.com/in/",
"",
).replace(/\/$/, ''),
2023-05-20 00:11:07 +02:00
photoUrl: $('img[loading="lazy"]', el).attr("src"),
2023-05-04 21:12:54 +02:00
};
if (peopleMapper[name]) {
Object.assign(item, peopleMapper[name]);
}
out.speakers.push(item);
}
return out;
}