@rolme/ytscript
Version:
A CLI tool to download YouTube transcripts and generate summaries
21 lines (20 loc) • 657 B
JavaScript
import { AIProviderFactory } from './providers/factory.js';
export class SummaryService {
provider;
constructor(options = {}) {
this.provider = AIProviderFactory.create(options);
}
async summarizeTranscript(transcript, options = {}) {
try {
const summary = await this.provider.summarize(transcript.transcript, options);
return {
...transcript,
summary,
provider: 'google'
};
}
catch (error) {
throw new Error(`Summarization failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
}
}