diff --git a/libs/community/langchain_community/document_loaders/youtube.py b/libs/community/langchain_community/document_loaders/youtube.py index 67c1569adf8d6..fd7634750400b 100644 --- a/libs/community/langchain_community/document_loaders/youtube.py +++ b/libs/community/langchain_community/document_loaders/youtube.py @@ -319,7 +319,13 @@ def _get_video_info(self) -> Dict: 'Could not import "pytube" Python package. ' "Please install it with `pip install pytube`." ) - yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}") + yt_url = f"https://www.youtube.com/watch?v={self.video_id}" + yt = YouTube( + yt_url, + use_oauth=True, + allow_oauth_cache=True + + ) video_info = { "title": yt.title or "Unknown", "description": yt.description or "Unknown",