Route MP3 buttons through Suno UI download
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name ChatGPT to Suno Prompt Copier
|
||||
// @namespace local.suno-helper
|
||||
// @version 0.9.8
|
||||
// @version 0.9.9
|
||||
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
||||
// @author local
|
||||
// @match https://chatgpt.com/*
|
||||
@@ -30,7 +30,7 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const SCRIPT_VERSION = "0.9.8";
|
||||
const SCRIPT_VERSION = "0.9.9";
|
||||
const STORAGE_KEY = "chatgptSunoPromptSlots";
|
||||
const SLOT_COUNT = 2;
|
||||
const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com");
|
||||
@@ -75,15 +75,18 @@
|
||||
|
||||
const originalFetch = page.fetch;
|
||||
if (typeof originalFetch === "function") {
|
||||
page.fetch = async function (...args) {
|
||||
const response = await originalFetch.apply(this, args);
|
||||
const url = args[0]?.url || args[0] || response.url || "";
|
||||
if (/suno/i.test(String(url))) {
|
||||
response.clone().text().then((text) => {
|
||||
rememberSunoResponse(url, tryParseJson(text) || text);
|
||||
}).catch(() => {});
|
||||
}
|
||||
return response;
|
||||
page.fetch = function (...args) {
|
||||
const result = originalFetch.apply(this, args);
|
||||
result.then((response) => {
|
||||
const url = args[0]?.url || args[0] || response.url || "";
|
||||
const urlText = String(url);
|
||||
if (/suno/i.test(urlText) && !/agg-receiver-service|datadoghq|braze|sprig|cloudflareinsights/i.test(urlText)) {
|
||||
response.clone().text().then((text) => {
|
||||
rememberSunoResponse(url, tryParseJson(text) || text);
|
||||
}).catch(() => {});
|
||||
}
|
||||
}).catch(() => {});
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1814,15 +1817,15 @@
|
||||
</div>
|
||||
<div class="cgs-track-list" data-cgs-track-list></div>
|
||||
<div class="cgs-row">
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-process-one-mp3>선택 1곡 MP3</button>
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-process-one-mp3>선택 1곡 MP3(UI)</button>
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-process-one-wav>선택 1곡 WAV(UI)</button>
|
||||
</div>
|
||||
<div class="cgs-row">
|
||||
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-selected-mp3>선택항목 MP3</button>
|
||||
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-selected-mp3>선택항목 MP3(UI)</button>
|
||||
<button class="cgs-btn cgs-primary cgs-wide" type="button" data-cgs-process-selected-wav>선택항목 WAV(UI)</button>
|
||||
</div>
|
||||
<div class="cgs-row">
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-ui-download-mp3>SUNO UI MP3 클릭</button>
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-ui-download-mp3>SUNO UI MP3 재시도</button>
|
||||
<button class="cgs-btn cgs-wide" type="button" data-cgs-ui-download-wav>SUNO UI WAV 재시도</button>
|
||||
</div>
|
||||
<div class="cgs-row">
|
||||
@@ -2035,7 +2038,7 @@
|
||||
};
|
||||
|
||||
body.querySelector("[data-cgs-process-one-mp3]").addEventListener("click", async () => {
|
||||
await processSelectedTrack("mp3");
|
||||
await clickSelectedSunoUiDownloads("mp3", { one: true });
|
||||
});
|
||||
|
||||
body.querySelector("[data-cgs-process-one-wav]").addEventListener("click", async () => {
|
||||
@@ -2043,7 +2046,7 @@
|
||||
});
|
||||
|
||||
body.querySelector("[data-cgs-process-selected-mp3]").addEventListener("click", async () => {
|
||||
await processSelectedTracks("mp3");
|
||||
await clickSelectedSunoUiDownloads("mp3");
|
||||
});
|
||||
|
||||
body.querySelector("[data-cgs-process-selected-wav]").addEventListener("click", async () => {
|
||||
|
||||
Reference in New Issue
Block a user