05-05-2024, 07:37 AM
هندسة عكسية ل OpenAI backend API تنزيل صوت محادثة عالي الجودة MP3
https://www.youtube.com/watch?v=x5m1g_hnoNE
Code:
https://www.youtube.com/watch?v=x5m1g_hnoNE
Code:
async function fetchData() {
try {
// Get textarea and its data-id attribute
const textarea = document.getElementById('prompt-textarea');
const messageId = textarea.getAttribute('data-id');
// Extract conversation_id from URL
const url = window.location.href;
const conversationId = url.split('/').pop();
// Perform GET request to obtain Bearer token
const authResponse = await fetch('https://chatgpt.com/api/auth/session', {
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
}
});
const authData = await authResponse.json();
const accessToken = authData.accessToken;
// Perform GET request using Bearer token and conversation_id
const response = await fetch(`https://chatgpt.com/backend-api/synthesize?message_id=${messageId}&conversation_id=${conversationId}&voice=breeze&format=mp3`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
}
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Convert response to blob
const blob = await response.blob();
// Create a temporary anchor element to trigger the download
const _url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = _url;
a.download = `${messageId}.mp3`;
document.body.appendChild(a);
// Trigger the download
a.click();
// Clean up
window.URL.revokeObjectURL(_url);
a.remove();
} catch (error) {
console.error('Error:', error);
}
}
fetchData();
هندسة عكسية ل OpenAI backend API تنزيل صوت محادثة عالي الجودة MP3 mobile على هاتفك الجوال
https://www.youtube.com/shorts/n_WaalCzUkw