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_apipython 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_infocaptions_languagechannel_namecontinue_on_failurevideo_idsMethods
__init__(google_api_client[,Β channel_name,Β ...])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__(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) None#
- 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) β
- 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