Handle redirected Suno WAV responses

This commit is contained in:
DESKTOP-KSVGT20\shkim
2026-05-02 00:21:24 +09:00
parent d508c7fc80
commit fa2c9e8b2d
+5 -2
View File
@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name ChatGPT to Suno Prompt Copier // @name ChatGPT to Suno Prompt Copier
// @namespace local.suno-helper // @namespace local.suno-helper
// @version 0.7.4 // @version 0.7.5
// @description Copy structured ChatGPT song prompt versions into Suno fields. // @description Copy structured ChatGPT song prompt versions into Suno fields.
// @author local // @author local
// @match https://chatgpt.com/* // @match https://chatgpt.com/*
@@ -27,7 +27,7 @@
(function () { (function () {
"use strict"; "use strict";
const SCRIPT_VERSION = "0.7.4"; const SCRIPT_VERSION = "0.7.5";
const STORAGE_KEY = "chatgptSunoPromptSlots"; const STORAGE_KEY = "chatgptSunoPromptSlots";
const SLOT_COUNT = 2; const SLOT_COUNT = 2;
const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com"); const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com");
@@ -827,6 +827,9 @@
...(options.headers || {}), ...(options.headers || {}),
}, },
}); });
const finalUrl = response.url || url;
const finalWavUrl = extractWavUrl(finalUrl);
if (response.ok && finalWavUrl) return finalWavUrl;
const text = await response.text(); const text = await response.text();
const data = tryParseJson(text) || text; const data = tryParseJson(text) || text;
rememberSunoResponse(url, data); rememberSunoResponse(url, data);