fix: expand og:image regexp

This commit is contained in:
Daniel Roe 2022-12-12 20:58:03 +00:00
parent 797b99f122
commit bb013ddd18
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55

View file

@ -18,8 +18,8 @@ function getOpenGraphClient(): OpenGraphClient {
}
function extractOgImageUrl(html: string): string {
const match = html.match(/<meta property="og:image" content="([^"]+)" \/>/)
return match?.[1] ?? ''
const match = html.match(/<meta[^>]*property="og:image"[^>]*content="([^"]+)"|<meta[^>]*content="([^"]+)"[^>]*property="og:image"/)
return match?.[1] ?? match?.[2] ?? ''
}
async function resolveOgImageUrlManually(cardUrl: string): Promise<string> {