async function shortenWithTinyUrl(longUrl) { try { const response = await fetch(`https://tinyurl.com/api-create.php?url=${encodeURIComponent(longUrl)}`); const shortUrl = await response.text(); document.getElementById('result').innerHTML = `Сокращённая ссылка: ${shortUrl}`; } catch (error) { console.error('Ошибка:', error); } }