GoogleApiYoutubeLoader#
- class langchain_community.document_loaders.youtube.GoogleApiYoutubeLoader(google_api_client: GoogleApiClient, channel_name: str | None = None, video_ids: List[str] | None = None, add_video_info: bool = True, captions_language: str = 'en', continue_on_failure: bool = False)[source]#
Load all Videos from a YouTube Channel.
To use, you should have the
googleapiclient,youtube_transcript_api
python package installed. As the service needs a google_api_client, you first have to initialize the GoogleApiClient.Additionally you have to either provide a channel name or a list of videoids “https://developers.google.com/docs/api/quickstart/python”
Example
from langchain_community.document_loaders import GoogleApiClient from langchain_community.document_loaders import GoogleApiYoutubeLoader google_api_client = GoogleApiClient( service_account_path=Path("path_to_your_sec_file.json") ) loader = GoogleApiYoutubeLoader( google_api_client=google_api_client, channel_name = "CodeAesthetic" ) load.load()
Attributes
add_video_info
captions_language
channel_name
continue_on_failure
video_ids
Methods
__init__
(*args, **kwargs)A lazy loader for Documents.
aload
()Load data into Document objects.
A lazy loader for Documents.
load
()Load documents.
load_and_split
([text_splitter])Load Documents and split into chunks.
Validate that either folder_id or document_ids is set, but not both.
- Parameters:
google_api_client (GoogleApiClient)
channel_name (str | None)
video_ids (List[str] | None)
add_video_info (bool)
captions_language (str)
continue_on_failure (bool)
- __init__(*args: Any, **kwargs: Any) None #
- Parameters:
__dataclass_self__ (PydanticDataclass)
args (Any)
kwargs (Any)
- Return type:
None
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- load_and_split(text_splitter: TextSplitter | None = None) list[Document] #
Load Documents and split into chunks. Chunks are returned as Documents.
Do not override this method. It should be considered to be deprecated!
- Parameters:
text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.
- Returns:
List of Documents.
- Return type:
list[Document]
Examples using GoogleApiYoutubeLoader