AIS images

This commit is contained in:
2026-07-04 22:32:17 -04:00
parent 1038b06a46
commit a1c714847d

View File

@@ -93,10 +93,10 @@ export async function getAISImage(mmsi) {
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' } headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' }
}) })
const html = await res.text() const html = await res.text()
const match = html.match(/<img\s[^>]*?class=["'][^"']*main-photo[^"']*["'][^>]*?>/) const match = html.match(/<img.+main-photo.+>/)
if (!match) throw new Error('No main-photo image found') if (!match) throw new Error('No main-photo image found')
const srcMatch = match[0].match(/src=["']([^"']+)["']/) const srcMatch = match[0].match(/src="(.+?)"/)
if (!srcMatch) throw new Error('No src found on main-photo image') if (!srcMatch) throw new Error('No src found on main-photo image')
let imgUrl = srcMatch[1] let imgUrl = srcMatch[1]