Open ymcki opened 2 weeks ago
I was trying to run this jupyter notebook https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb
Then it crashes at the beginning
from langchain_community.document_loaders import YoutubeLoader docs = YoutubeLoader.from_youtube_url( "https://www.youtube.com/watch?v=pbAd8O1Lvm4", add_video_info=True, ).load() print(docs[0].metadata)
Traceback (most recent call last): File "/home/user/anaconda3/envs/ai/lib/python3.10/site-packages/pytube/main.py", line 341, in title self._title = self.vid_info['videoDetails']['title'] KeyError: 'videoDetails'
After I dig more into why it crashed, I find that it is due to this video requires login.
By modifying line 322 of langchain_community/document_loaders/youtube.py from yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}") to yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}", use_oauth=True, allow_oauth_cache=True)
Then it asks me to login and then it works.
I think this "bug" can be fixed by adding these two arguments to YoutubeLoader.from_youtube_url and pass them to pytube.
langchain 0.3.4 langchain-community 0.3.3
Can I work on this issue?
I want to work on this issue
The same problem here trying to develop a langchain project using YoutubeLoader
Checked other resources
Example Code
I was trying to run this jupyter notebook https://github.com/langchain-ai/rag-from-scratch/blob/main/rag_from_scratch_10_and_11.ipynb
Then it crashes at the beginning
Error Message and Stack Trace (if applicable)
Traceback (most recent call last): File "/home/user/anaconda3/envs/ai/lib/python3.10/site-packages/pytube/main.py", line 341, in title self._title = self.vid_info['videoDetails']['title'] KeyError: 'videoDetails'
Description
After I dig more into why it crashed, I find that it is due to this video requires login.
By modifying line 322 of langchain_community/document_loaders/youtube.py from yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}") to yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}", use_oauth=True, allow_oauth_cache=True)
Then it asks me to login and then it works.
I think this "bug" can be fixed by adding these two arguments to YoutubeLoader.from_youtube_url and pass them to pytube.
System Info
langchain 0.3.4 langchain-community 0.3.3