const videoUrl = document.getElementById("video_url").value; fetch("https://api.y2mate.com/v3/convert", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ url: videoUrl }) }) .then(response => response.json()) .then(data => { fetch(data.download_link) .then(response => response.blob()) .then(blob => { // Save the MP3 file to the user's computer. const url = window.URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = "video.mp3"; a.click(); }); });