import { json } from '@remix-run/node'; import type { ActionFunctionArgs } from '@remix-run/node'; export async function action({ request }: ActionFunctionArgs) { try { const formData = await request.formData(); const url = formData.get('url') as string; if (!url) { return json({ error: 'URL is required' }, { status: 400 }); } const response = await fetch(url); if (!response.ok) { throw new Error(`Failed to fetch URL: ${response.status} ${response.statusText}`); } const html = await response.text(); // Basic HTML parsing to extract title and content const titleMatch = html.match(/