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 regels
909 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. openaiOrganizationId,
  17. openaiApiKey,
  18. language,
  19. country,
  20. } = params;
  21. switch (videoType as string) {
  22. case VideoType.YOUTUBE:
  23. return new YouTubeSummarizerEventEmitter({
  24. url,
  25. openaiOrganizationId,
  26. openaiApiKey,
  27. language,
  28. country,
  29. });
  30. default:
  31. break;
  32. }
  33. throw new TypeError(`Invalid video type: "${videoType}". Valid values are: ${JSON.stringify(Object.values(VideoType))}`);
  34. };