This commit is contained in:
Andrey Kondratev
2025-08-28 13:41:56 +05:00
parent 57f0519a32
commit 913f833b8c
4 changed files with 66 additions and 17 deletions

View File

@@ -60,7 +60,7 @@ app.post('/api/search', async (req: Request, res: Response) => {
// Convert video to MP3
app.post('/api/convert', async (req: Request, res: Response) => {
try {
const { videoId, title, userId }: { videoId?: string; title?: string; userId?: string } = req.body;
const { videoId, title, userId, url }: { videoId?: string; title?: string; userId?: string; url?: string } = req.body;
console.log('Convert request received:', { videoId, title, userId });
if (!videoId) {
@@ -84,7 +84,7 @@ app.post('/api/convert', async (req: Request, res: Response) => {
try {
// Get audio stream from YouTube
console.log(`Attempting to get audio stream for: ${videoId}`);
const audioStream = await soundcloud.getAudioStream(videoId);
const audioStream = await soundcloud.getAudioStream(videoId, url);
console.log('Audio stream obtained, starting FFmpeg conversion...');
// Convert to MP3 using ffmpeg