source |
---|
async function getTitle(url) {
const response = await fetch(`https://api.allorigins.win/get?url=${encodeURIComponent(url)}`)
const { contents } = await response.json()
const title = contents.match(/<title>(?<title>.*)<\/title>/)?.groups?.title ?? ''
return title
}
#snippet #lumen/app #javascript