From d2201bc02d828a8e3ac3ee1aa89752ac90fedbb8 Mon Sep 17 00:00:00 2001 From: Badri467 <114822924+Badri467@users.noreply.github.com> Date: Tue, 1 Jul 2025 12:09:30 +0530 Subject: [PATCH] Fix transcript timestamps --- Backend/transcript-fetcher.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Backend/transcript-fetcher.js b/Backend/transcript-fetcher.js index 95c1aa1..127cd83 100644 --- a/Backend/transcript-fetcher.js +++ b/Backend/transcript-fetcher.js @@ -40,11 +40,11 @@ const fetchTranscriptWithRetry = async (videoId, maxRetries = RETRY_CONFIG.maxRe if (transcript && transcript.length > 0) { console.log(`✅ Successfully fetched transcript with ${transcript.length} segments`); - return transcript.map(item => ({ - text: item.text, - start: parseFloat(item.offset) / 1000, - duration: parseFloat(item.duration) / 1000 - })); + return transcript.map(item => ({ + text: item.text, + start: parseFloat(item.offset), + duration: parseFloat(item.duration) + })); } } catch (error) { lastError = error; @@ -86,11 +86,11 @@ const fetchTranscriptWithRetry = async (videoId, maxRetries = RETRY_CONFIG.maxRe if (transcript && transcript.length > 0) { console.log(`✅ Success with alternative format!`); - return transcript.map(item => ({ - text: item.text, - start: parseFloat(item.offset) / 1000, - duration: parseFloat(item.duration) / 1000 - })); + return transcript.map(item => ({ + text: item.text, + start: parseFloat(item.offset), + duration: parseFloat(item.duration) + })); } } catch (altError) { console.log(`Alternative format failed: ${altError.message}`); @@ -135,11 +135,11 @@ const tryManualTranscriptExtraction = async (videoId) => { if (transcript && transcript.length > 0) { console.log('✅ Manual extraction successful!'); - return transcript.map(item => ({ - text: item.text, - start: parseFloat(item.start || item.offset) / 1000, - duration: parseFloat(item.dur || item.duration) / 1000 - })); + return transcript.map(item => ({ + text: item.text, + start: parseFloat(item.start || item.offset), + duration: parseFloat(item.dur || item.duration) + })); } }