Get transcript summaries of Web videos.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 rivejä
880 B

  1. import { SummarizerEventEmitter } from './common';
  2. import {
  3. CreateYouTubeSummarizerParams,
  4. YouTubeSummarizerEventEmitter,
  5. } from './video-types/youtube';
  6. export enum VideoType {
  7. YOUTUBE = 'youtube',
  8. }
  9. export interface CreateSummarizerParams extends CreateYouTubeSummarizerParams {
  10. type: VideoType;
  11. }
  12. export const createSummarizer = (params: CreateSummarizerParams): SummarizerEventEmitter => {
  13. const {
  14. type: videoType,
  15. url,
  16. openAiParams,
  17. language,
  18. country,
  19. } = params;
  20. switch (videoType as string) {
  21. case VideoType.YOUTUBE:
  22. return new YouTubeSummarizerEventEmitter({
  23. url,
  24. openAiParams,
  25. language,
  26. country,
  27. });
  28. default:
  29. break;
  30. }
  31. throw new TypeError(`Invalid video type: "${videoType}". Valid values are: ${JSON.stringify(Object.values(VideoType))}`);
  32. };
  33. export * from './common';