langchain_community.document_loaders.youtube.YoutubeLoader¶

class langchain_community.document_loaders.youtube.YoutubeLoader(video_id: str, add_video_info: bool = False, language: Union[str, Sequence[str]] = 'en', translation: Optional[str] = None, continue_on_failure: bool = False)[source]¶

Load YouTube transcripts.

Initialize with YouTube video ID.

Methods

__init__(video_id[, add_video_info, ...])

Initialize with YouTube video ID.

extract_video_id(youtube_url)

Extract video id from common YT urls.

from_youtube_url(youtube_url, **kwargs)

Given youtube URL, load video.

lazy_load()

A lazy loader for Documents.

load()

Load documents.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(video_id: str, add_video_info: bool = False, language: Union[str, Sequence[str]] = 'en', translation: Optional[str] = None, continue_on_failure: bool = False)[source]¶

Initialize with YouTube video ID.

static extract_video_id(youtube_url: str) str[source]¶

Extract video id from common YT urls.

classmethod from_youtube_url(youtube_url: str, **kwargs: Any) YoutubeLoader[source]¶

Given youtube URL, load video.

lazy_load() Iterator[Document]¶

A lazy loader for Documents.

load() List[Document][source]¶

Load documents.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

Load Documents and split into chunks. Chunks are returned as Documents.

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using YoutubeLoader¶