/**
 * Dump a chunk of Awwwards SOTD HTML so we can see actual card structure.
 */

async function main(): Promise<void> {
  const res = await fetch('https://www.awwwards.com/websites/sites_of_the_day/', {
    headers: {
      'User-Agent': 'SANDCODE/eye-ingester inspection',
      Accept: 'text/html',
    },
  })
  const html = await res.text()

  // Find the first reference to /sites/ and print surrounding context
  const idx = html.indexOf('/sites/')
  if (idx === -1) {
    process.stdout.write('NO /sites/ ANCHOR FOUND\n')
    return
  }
  process.stdout.write('HTML length: ' + html.length + '\n')
  process.stdout.write('First /sites/ at: ' + idx + '\n\n')
  process.stdout.write('--- context around first card ---\n')
  process.stdout.write(html.slice(Math.max(0, idx - 2000), idx + 3000))
  process.stdout.write('\n--- end ---\n')
}

main().catch((err: unknown) => {
  process.stderr.write(String(err) + '\n')
  process.exit(1)
})
