Match Suno MP3 download preflight
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
companion-inbox/
|
companion-inbox/
|
||||||
companion-logs/
|
companion-logs/
|
||||||
_work/
|
_work/
|
||||||
|
*.har
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user