Update cobalt.js

This commit is contained in:
wukko 2022-09-01 20:11:04 +06:00
parent a12300efe2
commit 659d2f4c4c

View file

@ -221,8 +221,8 @@ async function download(url) {
if (sGet("fullTikTokAudio") == "true") format += `&ttfull=true` if (sGet("fullTikTokAudio") == "true") format += `&ttfull=true`
} }
let mode = (sGet("audioMode") == "true") ? `audio=true` : `quality=${sGet("quality")}` let mode = (sGet("audioMode") == "true") ? `audio=true` : `quality=${sGet("quality")}`
fetch(`/api/json?audioFormat=${sGet("audioFormat")}&${mode}${format}&url=${encodeURIComponent(url)}`).then(async (response) => { await fetch(`/api/json?audioFormat=${sGet("audioFormat")}&${mode}${format}&url=${encodeURIComponent(url)}`).then(async (r) => {
let j = await response.json(); let j = await r.json();
if (j.status != "error" && j.status != "rate-limit") { if (j.status != "error" && j.status != "rate-limit") {
if (j.url) { if (j.url) {
switch (j.status) { switch (j.status) {
@ -240,8 +240,8 @@ async function download(url) {
break; break;
case "stream": case "stream":
changeDownloadButton(2, '?..') changeDownloadButton(2, '?..')
fetch(`${j.url}&p=1&origin=front`).then(async (response) => { fetch(`${j.url}&p=1&origin=front`).then(async (res) => {
let jp = await response.json(); let jp = await res.json();
if (jp.status == "continue") { if (jp.status == "continue") {
changeDownloadButton(2, '>>>') changeDownloadButton(2, '>>>')
window.location.href = j.url window.location.href = j.url