Match Suno MP3 download preflight

This commit is contained in:
DESKTOP-KSVGT20\shkim
2026-05-02 01:01:02 +09:00
parent dbfbd85576
commit da4aaa667e
2 changed files with 22 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
companion-inbox/ companion-inbox/
companion-logs/ companion-logs/
_work/ _work/
*.har
+21 -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.8.2 // @version 0.8.3
// @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/*
@@ -28,7 +28,7 @@
(function () { (function () {
"use strict"; "use strict";
const SCRIPT_VERSION = "0.8.2"; const SCRIPT_VERSION = "0.8.3";
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");
@@ -1155,6 +1155,25 @@
} }
async function downloadSunoMp3Buffer(track, statusTarget) { async function downloadSunoMp3Buffer(track, statusTarget) {
if (track.id) {
const id = encodeURIComponent(track.id);
setStatus(statusTarget, `SUNO MP3 다운로드 권한 요청 중: ${track.title || track.id}`);
for (const url of [
`https://studio-api-prod.suno.com/api/gen/${id}/increment_action_count/`,
`https://studio-api-prod.suno.com/api/billing/clips/${id}/download/`,
]) {
try {
await callSunoJson(url, { method: "POST" });
} catch (postError) {
try {
await callSunoJson(url, { method: "GET" });
} catch (getError) {
console.warn("[ChatGPT to Suno] MP3 preflight failed", url, postError, getError);
}
}
}
}
const candidates = getMp3Candidates(track); const candidates = getMp3Candidates(track);
if (!candidates.length) throw new Error("MP3 후보 URL 없음"); if (!candidates.length) throw new Error("MP3 후보 URL 없음");
for (const url of candidates) { for (const url of candidates) {