Skip to content

Commit

Permalink
Add homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Dec 29, 2024
1 parent 68fbcf3 commit e80bd7c
Show file tree
Hide file tree
Showing 22 changed files with 502 additions and 392 deletions.
11 changes: 0 additions & 11 deletions app/elements/list-events.mjs

This file was deleted.

30 changes: 0 additions & 30 deletions app/elements/list-links.mjs

This file was deleted.

45 changes: 0 additions & 45 deletions app/elements/list-organizers.mjs

This file was deleted.

35 changes: 0 additions & 35 deletions app/elements/list-sponsors.mjs

This file was deleted.

23 changes: 0 additions & 23 deletions app/elements/list-talks.mjs

This file was deleted.

37 changes: 0 additions & 37 deletions app/elements/view-event.mjs

This file was deleted.

25 changes: 0 additions & 25 deletions app/elements/view-sponsor.mjs

This file was deleted.

86 changes: 0 additions & 86 deletions app/elements/view-talk.mjs

This file was deleted.

36 changes: 0 additions & 36 deletions app/pages/index.html

This file was deleted.

43 changes: 43 additions & 0 deletions crawl.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import fs from 'fs'

const queue = ['https://seattlejs.com/', 'https://seattlejs.com/events']
/** @type {Set<string>} */
// eslint-disable-next-line no-undef
const visited = new Set()

async function crawl() {
while (queue.length) {
let url = queue.shift()
if (!url || visited.has(url)) continue

visited.add(url)
console.log(`Crawling ${url}`)

let res = await fetch(url)
let text = await res.text()
let matches = text.match(/https?:\/\/[^'"\s)]+/g) || []

const links = text.match(/href="([^"]+)"/g) || []
matches = matches.concat(
...links
.map(m => {
const url = m.match(/href="([^"]+)"/)[1]
if (url.match(/^https?:\/\/seattlejs.com/)) return url
if (url.startsWith('/')) return `https://seattlejs.com${url}`
return null
})
.filter(m => !!m),
)

// console.log(matches)

for (let match of matches) {
if (match.match(/^https?:\/\/seattlejs.com/)) {
queue.push(match)
}
}
}
}

await crawl()
fs.writeFileSync('urls.json', JSON.stringify(Array.from(visited), null, 2))
Loading

0 comments on commit e80bd7c

Please sign in to comment.