refactor: changed /info router from POST to GET

This commit is contained in:
MasterAcnolo
2026-08-07 21:13:12 +02:00
parent 5d676b45e7
commit 7a0cbd7456
3 changed files with 23 additions and 10 deletions

View File

@@ -30,15 +30,15 @@ function formatSize(bytes) {
*/
async function fetchVideoInfo(url) {
try {
const res = await fetch("/info", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({ url }),
const res = await fetch(`/info?url=${encodeURIComponent(url)}`, {
method: "GET",
headers: {"Accept": "application/json"}
});
if (!res.ok) return { error: `An Error occured when fetching info` };
const data = await res.json();
if (!res.ok) return {error: `An Error occured when fetching info`};
if (!data) return { error: "Data is Missing" };
return data;