Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Backend/transcript-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`);
Expand Down Expand Up @@ -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)
}));
}
}

Expand Down