forked from Gamer219-prog/Gamer219-prog.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (22 loc) · 807 Bytes
/
script.js
File metadata and controls
26 lines (22 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
async function fetchDirectLink() {
const ytLink = document.getElementById("yt-link").value;
const output = document.getElementById("output");
output.innerHTML = "⏳ Wird verarbeitet...";
try {
const response = await fetch("/get_link", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ url: ytLink })
});
const data = await response.json();
if (data.error) {
output.innerHTML = `<span style="color: red;">❌ Fehler: ${data.error}</span>`;
} else {
output.innerHTML = `✅ <strong>Direktlink:</strong> <a href="${data.direct_url}" target="_blank">${data.direct_url}</a>`;
}
} catch (err) {
output.innerHTML = `<span style="color: red;">❌ Verbindung fehlgeschlagen</span>`;
}
}