// Input: full Google Drive URL from previous node or JSON field const fullUrl = $json["gd link reference image"] || '';

// Function to extract file ID from Google Drive URL function extractDriveFileId(url) { if (!url) return ''; const match = url.match(/\/d\/([a-zA-Z0-9_-]+)/); return match ? match[1] : ''; }

const fileId = extractDriveFileId(fullUrl);

// Build fal.ai compatible image_urls array const image_urls = fileId ? ['https://drive.google.com/uc?export=download&id=' + fileId] : [];

return [ { json: { fileId, image_urls, }, }, ];