From dfa38c13be551ea49aba32bb5395affd4c143613 Mon Sep 17 00:00:00 2001 From: tree Date: Thu, 1 Feb 2024 13:08:55 +0100 Subject: [PATCH] guest list --- package.json | 3 +- src/components/EventItem.astro | 24 +++ src/events-ext.json | 293 +++++++++++++++++++++++++++++++++ utils/events-ext.js | 35 ++++ 4 files changed, 354 insertions(+), 1 deletion(-) create mode 100644 src/events-ext.json create mode 100644 utils/events-ext.js diff --git a/package.json b/package.json index 7967893..b3f7584 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "articles": "deno run --allow-all utils/articles.js", "talks": "deno run --allow-all utils/talks.js", "explorer": "deno run --allow-all utils/explorer.js", - "sync-all": "npm run core && npm run contribs && npm run articles && npm run talks && npm run explorer" + "events-ext": "deno run --allow-all utils/events-ext.js", + "sync-all": "npm run core && npm run contribs && npm run articles && npm run talks && npm run explorer && npm run events-ext" }, "dependencies": { "@astrojs/tailwind": "^5.0.2", diff --git a/src/components/EventItem.astro b/src/components/EventItem.astro index f53af0b..2bb72d2 100644 --- a/src/components/EventItem.astro +++ b/src/components/EventItem.astro @@ -2,6 +2,23 @@ const { item } = Astro.props; import { format, compareAsc, addDays, isFuture } from 'date-fns'; import { marked } from 'marked'; +import EventsExt from '../events-ext.json'; + +function findExt () { + let slug = null + if (item.links?.web && item.links.web.match(/^https:\/\/lu.ma\//)) { + slug = item.links.web.match(/^https:\/\/lu.ma\/(.+)$/)[1] + } + if (item.links?.rsvp && item.links.rsvp.match(/^https:\/\/lu.ma\//)) { + slug = item.links.rsvp.match(/^https:\/\/lu.ma\/(.+)$/)[1] + } + if (!slug) { + return null + } + return EventsExt.find(ex => ex.url === slug) +} + +const ext = findExt() const isDate = item.date.match(/^\d{4}-\d{2}-\d{2}$/) const future = isDate && !isFuture(new Date(item.date)); @@ -102,6 +119,13 @@ const status = item.confirmed
+ {ext && +
+ {ext.guests.map((guest) => ( +
+ ))} +
+ } {/*
*/} {item.links?.rsvp && diff --git a/src/events-ext.json b/src/events-ext.json new file mode 100644 index 0000000..df5e98b --- /dev/null +++ b/src/events-ext.json @@ -0,0 +1,293 @@ +[ + { + "url": "w3pn-meetup-bucharest1", + "name": "W3PN Meetup @ ETHBucharest 2024", + "period": [ + "2024-03-28T13:00:00.000Z", + "2024-03-28T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 3, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "RSSC No1", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_39.png" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-meetup-ams1", + "name": "W3PN Meetup @ ETHDam 2024", + "period": [ + "2024-04-11T13:00:00.000Z", + "2024-04-11T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 12, + "guests": [ + { + "name": "Lanaryx", + "avatarUrl": "https://images.lumacdn.com/avatars/fu/355e98ad-8cdc-4e6a-8066-96fd9c505f24" + }, + { + "name": "Alina Latinina", + "avatarUrl": "https://images.lumacdn.com/avatars/1x/73d8754f-c813-4603-90cd-a1233e12eb1a" + }, + { + "name": "Kieran Mesquita", + "avatarUrl": "https://images.lumacdn.com/avatars/0c/b0ba4716-d35b-48b3-9523-62242e583013" + }, + { + "name": "Dietrich Ayala", + "avatarUrl": "https://cdn.lu.ma/avatars/yx/da86d2b5-aa0e-4c77-8f06-eda042415b2c" + }, + { + "name": "limone.eth", + "avatarUrl": "https://cdn.lu.ma/avatars/zo/9b09a4b5-59b6-47cd-b988-32ed7f22dc1e" + }, + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "Jacob Czepluch", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_13.png" + }, + { + "name": "HW", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_19.png" + }, + { + "name": "Who?", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_24.png" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-meetup-tallinn1", + "name": "W3PN Meetup @ ETHTallinn 2024", + "period": [ + "2024-04-18T12:00:00.000Z", + "2024-04-18T18:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 4, + "guests": [ + { + "name": "Sander Gansen", + "avatarUrl": "https://images.lumacdn.com/avatars/n9/3185a69c-8877-44a2-a3bd-d8ca324dae8d" + }, + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "HW", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_19.png" + }, + { + "name": "Ashton Barger", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_29.png" + } + ] + }, + { + "url": "w3pn-meetup-berlin1", + "name": "W3PN Meetup @ ETHBerlin 4", + "period": [ + "2024-05-22T13:00:00.000Z", + "2024-05-22T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 7, + "guests": [ + { + "name": "will scott", + "avatarUrl": "https://cdn.lu.ma/avatars/66/778a15b0-1e8b-4c45-9011-f3d19dd7cc90" + }, + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "Orion", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_16.png" + }, + { + "name": "alex v", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_37.png" + }, + { + "name": "Elena Grafenhorst", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_38.png" + }, + { + "name": "Jacob Czepluch", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_13.png" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-summit-prague2", + "name": "W3PN Summit @ ETHPrague 2024", + "period": [ + "2024-05-30T07:00:00.000Z", + "2024-05-31T02:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 4, + "guests": [ + { + "name": "Ashoat Tevosyan", + "avatarUrl": "https://cdn.lu.ma/avatars/b1/66f83394-ad58-4848-8c29-292cac308fa1" + }, + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "HW", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_19.png" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-bled-hackathon1", + "name": "W3PN Hackathon @ Bled", + "period": [ + "2024-06-19T13:00:00.000Z", + "2024-06-26T13:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 0, + "guests": [] + }, + { + "url": "w3pn-meetup-ljubljana1", + "name": "W3PN Meetup @ Ljubljana", + "period": [ + "2024-06-21T13:00:00.000Z", + "2024-06-21T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 2, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-meetup-bru1", + "name": "W3PN Meetup @ EthCC 7", + "period": [ + "2024-07-12T13:00:00.000Z", + "2024-07-12T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 2, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-meetup-rome1", + "name": "W3PN Meetup @ ETHRome 2024", + "period": [ + "2024-10-03T13:00:00.000Z", + "2024-10-03T19:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 2, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-summit-brno1", + "name": "W3PN Summit @ ETHBrno 2024", + "period": [ + "2024-10-24T07:00:00.000Z", + "2024-10-25T02:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 2, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + }, + { + "url": "w3pn-meetup-devcon7", + "name": "W3PN Meetup @ Devcon 7", + "period": [ + "2024-11-11T08:00:00.000Z", + "2024-11-11T14:00:00.000Z" + ], + "coverUrl": "https://images.lumacdn.com/event-covers/pq/73637b17-538e-44fa-a75a-5da505ba9d47", + "guestCount": 4, + "guests": [ + { + "name": "tree", + "avatarUrl": "https://cdn.lu.ma/avatars/39/1bf939a4-c139-4008-96d8-ad5f729d94c3" + }, + { + "name": "Orion", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_16.png" + }, + { + "name": "vincent", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_40.png" + }, + { + "name": "bryce_gabari", + "avatarUrl": "https://cdn.lu.ma/avatars-default/avatar_18.png" + } + ] + } +] \ No newline at end of file diff --git a/utils/events-ext.js b/utils/events-ext.js new file mode 100644 index 0000000..30f2b79 --- /dev/null +++ b/utils/events-ext.js @@ -0,0 +1,35 @@ +import { parseFeed } from "https://deno.land/x/rss/mod.ts"; +import * as cheerio from "https://esm.sh/cheerio@1.0.0-rc.12"; + +const resp = await fetch("https://lu.ma/web3privacy"); +const html = await resp.text(); +const $ = cheerio.load(html); + +const dataRaw = $("script#__NEXT_DATA__").text(); +const data = JSON.parse(dataRaw); +const calendar = data.props.pageProps.initialData.data.calendar; + +const items = data.props.pageProps.initialData.data.featured_items; + +const output = []; +for (const item of items) { + const evt = item.event; + output.push({ + url: evt.url, + name: evt.name, + period: [evt.start_at, evt.end_at], + coverUrl: evt.cover_url, + guestCount: item.guest_count, + guests: item.featured_guests.map((fg) => ({ + name: fg.name, + avatarUrl: fg.avatar_url, + })), + }); + //console.log(item); +} + +await Deno.writeTextFile( + "./src/events-ext.json", + JSON.stringify(output, null, 2), +); +console.log(`File ./src/events-ext.json saved`);