Skip to main content

youtube-to-text

ai-research-agent / extractor/url-to-content/youtube-to-text

Extract

convertYoutubeToText()

function convertYoutubeToText(videoUrl, options?): object

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

Parameters

ParameterTypeDescription

videoUrl

string

options?

{ addTimestamps: boolean; timeout: boolean; }

options.addTimestamps?

boolean

default=true - true to return timestamps, default true

options.timeout?

boolean

default=5 - http request timeout

Returns

object

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.

NameType
contentstring
timestampsstring
word_countnumber

Author

ai-research-agent (2024)

Other

fetchViaYoutubeToTranscriptCom()

function fetchViaYoutubeToTranscriptCom(videoId, options): Object

Fetch-based scraper of youtubetotranscript.com

Parameters

ParameterType

videoId

any

options

{}

Returns

Object

content, timestamps - where content is the full text of the transcript, and timestamps is an array of [characterIndex, timeSeconds]