Gateway Cosmos: add sync
This commit is contained in:
rodič
ec09874536
revize
1f9ec86262
|
@ -0,0 +1,39 @@
|
|||
export async function data(tools) {
|
||||
const $ = await tools.loadHtmlUrl("https://gateway.events/");
|
||||
const out = { speakers: [] };
|
||||
|
||||
const peopleMapper = {
|
||||
//'Dušan Matuška': { country: 'sk' }
|
||||
}
|
||||
|
||||
for (const el of $("#speakers div.w-full.relative").toArray()) {
|
||||
const value = (path) => cleanup($(path, el).text());
|
||||
const name = value("h3 span")
|
||||
|
||||
const item = {
|
||||
id: tools.formatId(name),
|
||||
name,
|
||||
photoUrl: $("div.group img", el).attr("src"),
|
||||
caption: value("div.text-white"),
|
||||
twitter: $("div.flex a", el).attr("href")?.replace("https://twitter.com/","").replace(/\?lang=\w{2}$/, ''),
|
||||
//linkedin: $$("a.linkedIn", sp).attr("href")?.replace("https://www.linkedin.com/in/","").replace(/\/$/,""),
|
||||
//tag: value(".taxTag "),
|
||||
//country: 'xx',
|
||||
//desc: $$('p', sp).text(),
|
||||
//web: { url: $$(".www", sp).attr("href") },
|
||||
//link
|
||||
}
|
||||
|
||||
if (peopleMapper[name]) {
|
||||
Object.assign(item, peopleMapper[name])
|
||||
}
|
||||
out.speakers.push(item);
|
||||
}
|
||||
console.log(out)
|
||||
return out;
|
||||
}
|
||||
|
||||
function cleanup(str) {
|
||||
return str.replace(/(\s{2,}|\n)/g, " ").trim();
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"speakers": [
|
||||
{
|
||||
"id": "sunny-aggarwal",
|
||||
"name": "Sunny Aggarwal",
|
||||
"photoUrl": "https://ik.imagekit.io/treevio/tr:w-500/https://s3.eu-central-1.wasabisys.com/rbf-gateway/rbf-gateway/speakersc-list-4sxkyx-image.png?version=1675855162482",
|
||||
"caption": "Osmosis Co-Founder",
|
||||
"twitter": "sunnya97",
|
||||
"photo": "photos/speakers/sunny-aggarwal.png"
|
||||
},
|
||||
{
|
||||
"id": "zaki-manian",
|
||||
"name": "Zaki Manian",
|
||||
"photoUrl": "https://ik.imagekit.io/treevio/tr:w-500/https://s3.eu-central-1.wasabisys.com/rbf-gateway/rbf-gateway/speakersc-list-aj7n-q-image.png?version=1675855162482",
|
||||
"caption": "Sommelier Co-Founder",
|
||||
"twitter": "zmanian",
|
||||
"photo": "photos/speakers/zaki-manian.png"
|
||||
},
|
||||
{
|
||||
"id": "sergey-gorbunov",
|
||||
"name": "Sergey Gorbunov",
|
||||
"photoUrl": "https://ik.imagekit.io/treevio/tr:w-500/https://s3.eu-central-1.wasabisys.com/rbf-gateway/rbf-gateway/speakersc-list-rckxid-image.png?version=1675855162482",
|
||||
"caption": "Axelar Co-Founder",
|
||||
"twitter": "sergey_nog",
|
||||
"photo": "photos/speakers/sergey-gorbunov.png"
|
||||
},
|
||||
{
|
||||
"id": "dean-tribble",
|
||||
"name": "Dean Tribble",
|
||||
"photoUrl": "https://ik.imagekit.io/treevio/tr:w-500/https://s3.eu-central-1.wasabisys.com/rbf-gateway/rbf-gateway/speakersc-list-hu9osm-image.png?version=1675855162482",
|
||||
"caption": "Agoric Co-Founder",
|
||||
"twitter": "deantribble",
|
||||
"photo": "photos/speakers/dean-tribble.png"
|
||||
},
|
||||
{
|
||||
"id": "federico-kunze-kullmer",
|
||||
"name": "Federico Kunze Küllmer",
|
||||
"photoUrl": "https://ik.imagekit.io/treevio/tr:w-500/https://s3.eu-central-1.wasabisys.com/rbf-gateway/rbf-gateway/speakersc-list-najlp1-image.png?version=1675855162482",
|
||||
"caption": "Evmos Co-Founder",
|
||||
"twitter": "fekunze",
|
||||
"photo": "photos/speakers/federico-kunze-kullmer.png"
|
||||
}
|
||||
]
|
||||
}
|
Binární soubor nebyl zobrazen.
Za Šířka: | Výška: | Velikost: 29 KiB |
Binární soubor nebyl zobrazen.
Za Šířka: | Výška: | Velikost: 22 KiB |
Binární soubor nebyl zobrazen.
Za Šířka: | Výška: | Velikost: 31 KiB |
Binární soubor nebyl zobrazen.
Za Šířka: | Výška: | Velikost: 38 KiB |
Binární soubor nebyl zobrazen.
Za Šířka: | Výška: | Velikost: 25 KiB |
|
@ -261,7 +261,7 @@ class DeConf_Collection {
|
|||
if (!sp.photoUrl) continue;
|
||||
const ext = await posix.extname(sp.photoUrl);
|
||||
const dir = [photosDir, "speakers"].join("/");
|
||||
const ffn = (sp.id ? sp.id : nameId) + ext;
|
||||
const ffn = (sp.id ? sp.id : nameId) + ext.replace(/\?.+$/, "");
|
||||
const fn = [dir, ffn].join("/");
|
||||
if (await exists(fn)) {
|
||||
sp.photo = ["photos", "speakers", ffn].join("/");
|
||||
|
|
|
@ -45,5 +45,5 @@ export function formatId(str) {
|
|||
.normalize("NFD")
|
||||
.toLowerCase()
|
||||
.replace(/[\u0300-\u036F]/g, "")
|
||||
.replace(/\s+/, "-");
|
||||
.replace(/\s+/g, "-");
|
||||
}
|
||||
|
|
Načítá se…
Odkázat v novém úkolu