Function convertYoutubeToText

  • Fetch youtube.com video's webpage HTML for embedded transcript. If blocked, use scraper of alternative sites providing transcripts.

    Parameters

    • videoUrl: string
    • Optionaloptions: {
          addTimestamps: boolean;
          timeout: boolean;
      } = {}
      • addTimestamps: boolean

        default=true -

        • true to return timestamps, default true
      • timeout: boolean

        default=5 - http request timeout

    Returns {
        content: string;
        timestamps: string;
        word_count: number;
    }

    where content is the full text of the transcript,
    timestamps is a string of comma-separated [characterIndex, timeSeconds] pairs, and word_count is the number of words in the transcript.

    • content: string
    • timestamps: string
    • word_count: number