From 659d2f4c4cabac6b062a5809de11ec629d9aa4ba Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 1 Sep 2022 20:11:04 +0600 Subject: [PATCH] Update cobalt.js --- src/front/cobalt.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/front/cobalt.js b/src/front/cobalt.js index c8b6171d..b96a0f31 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -221,8 +221,8 @@ async function download(url) { if (sGet("fullTikTokAudio") == "true") format += `&ttfull=true` } let mode = (sGet("audioMode") == "true") ? `audio=true` : `quality=${sGet("quality")}` - fetch(`/api/json?audioFormat=${sGet("audioFormat")}&${mode}${format}&url=${encodeURIComponent(url)}`).then(async (response) => { - let j = await response.json(); + await fetch(`/api/json?audioFormat=${sGet("audioFormat")}&${mode}${format}&url=${encodeURIComponent(url)}`).then(async (r) => { + let j = await r.json(); if (j.status != "error" && j.status != "rate-limit") { if (j.url) { switch (j.status) { @@ -240,8 +240,8 @@ async function download(url) { break; case "stream": changeDownloadButton(2, '?..') - fetch(`${j.url}&p=1&origin=front`).then(async (response) => { - let jp = await response.json(); + fetch(`${j.url}&p=1&origin=front`).then(async (res) => { + let jp = await res.json(); if (jp.status == "continue") { changeDownloadButton(2, '>>>') window.location.href = j.url