Update sync
This commit is contained in:
rodič
90e22c56c0
revize
233fc87fc7
2
Makefile
2
Makefile
|
@ -17,4 +17,4 @@ build:
|
|||
deno run --unstable --allow-read --allow-write utils/exec.js build
|
||||
|
||||
event-sync:
|
||||
deno run --unstable --allow-read --allow-write --allow-net utils/eventSync.js
|
||||
deno run --unstable --allow-read --allow-write --allow-net utils/eventSync.js $(event)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
function cleanup(str) {
|
||||
return str.replace(/(\s{2,}|\n)/g, " ").trim();
|
||||
}
|
||||
|
||||
export async function data(tools) {
|
||||
const $ = await tools.loadHtmlUrl("https://www.btcprague.com/");
|
||||
const out = { speakers: [] };
|
||||
for (const el of $(".speaker").toArray()) {
|
||||
const value = (path) => cleanup($(path, el).text());
|
||||
out.speakers.push({
|
||||
name: value("h3"),
|
||||
photoUrl: $("img", el).attr("src"),
|
||||
bio: value(".popis"),
|
||||
twitter: $(".twitter", el).attr("href")?.replace("https://twitter.com/",""),
|
||||
web: $(".www", el).attr("href")
|
||||
? { url: $(".www", el).attr("href") }
|
||||
: undefined,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"speakers": [
|
||||
{
|
||||
"name": "Knut Svanholm",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2022/11/btcprague-knutsvanholm-320x320.jpg",
|
||||
"bio": "Author of the „∞ / 21M” book",
|
||||
"web": {
|
||||
"url": "https://www.knutsvanholm.com/"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Anita Posch",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2023/01/Anita-Posch-2-320x320.png",
|
||||
"bio": "Bitcoin educator & author"
|
||||
},
|
||||
{
|
||||
"name": "Dušan Matuška",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2023/01/Dusan-Matuska-320x320.png",
|
||||
"bio": "Bitcoin educator & miner"
|
||||
},
|
||||
{
|
||||
"name": "Roman Reher",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2022/11/btcprague-romanreher-320x320.jpg",
|
||||
"bio": "Founder of YT channel \"Blocktrainer\"",
|
||||
"twitter": "blocktrainer",
|
||||
"web": {
|
||||
"url": "https://www.blocktrainer.de/"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Giacomo Zucco",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2022/11/btcprague-giacomozucco-320x320.jpg",
|
||||
"bio": "Bitcoin entrepreneur & consultant",
|
||||
"twitter": "giacomozucco"
|
||||
},
|
||||
{
|
||||
"name": "Wolf von Laer",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2023/01/Wolf-von-Laer-320x320.jpg",
|
||||
"bio": "CEO of Students For Liberty"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin de Waal",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2023/01/Ben-de-Waal.jpg",
|
||||
"bio": "VP Engineering of Swan Bitcoin"
|
||||
},
|
||||
{
|
||||
"name": "Stephan Livera",
|
||||
"photoUrl": "https://www.btcprague.com/wp-content/uploads/2022/10/btcprague-stephanlivera-320x320.jpg",
|
||||
"bio": "Host of “Stephan Livera Podcast”",
|
||||
"twitter": "stephanlivera",
|
||||
"web": {
|
||||
"url": "https://stephanlivera.com/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
# the name of your event
|
||||
name = "BTC Prague 2023"
|
||||
shortname = "BTC Prague"
|
|
@ -1,6 +1,5 @@
|
|||
# the name of your event
|
||||
name = "ETHPrague 2023"
|
||||
|
||||
shortname = "ETHPrague"
|
||||
|
||||
# the name of the group organizing the event
|
||||
|
|
|
@ -133,6 +133,9 @@ class DeConf_Event {
|
|||
// data
|
||||
if (module.data) {
|
||||
const data = await module.data(syncTools);
|
||||
if (!JSON.stringify(data)) {
|
||||
return null;
|
||||
}
|
||||
await _jsonWrite([this.dir, "data.json"].join("/"), data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,11 @@ await dc.init();
|
|||
const entry = dc.entries[dc.entries.length - 1];
|
||||
console.log(`entry=${entry.id}`);
|
||||
|
||||
for (const event of entry.data.events) {
|
||||
await event.sync();
|
||||
if (Deno.args[0]) {
|
||||
const ev = entry.data.events.find((e) => e.id === Deno.args[0]);
|
||||
await ev.sync();
|
||||
} else {
|
||||
for (const event of entry.data.events) {
|
||||
await event.sync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
import cheerio from "https://esm.sh/cheerio";
|
||||
|
||||
export async function loadJSONUrl(url) {
|
||||
const resp = await fetch(url);
|
||||
const data = await resp.json();
|
||||
return data;
|
||||
return resp.json();
|
||||
}
|
||||
|
||||
export async function loadHtmlUrl(url) {
|
||||
const resp = await fetch(url);
|
||||
return cheerio.load(await resp.text());
|
||||
}
|
||||
|
|
Načítá se…
Odkázat v novém úkolu