You may use this Python script to create a useful AI Q&A assistant that answers questions based on YouTube video transcriptions. The langchain_google_genai and youtube_transcript_api libraries are used to retrieve transcripts and offer answers.
- Get transcripts of YouTube videos from URLs.
- Respond to customer inquiries and create video transcripts.
-
Clone the repository:
git clone https://github.com/ShayanAliProgrammar/youtube-ai.git
-
Install the essential prerequisites.
pip install langchain==0.1.12 langchain-google-genai==0.0.11 youtube-transcript-api==0.6.2
-
Run this script:
python main.py
-
When asked, provide the URL to an allowed YouTube video.
-
Submit your question to the helper here.
-
Receive the response generated from the video transcription that was provided.
Here's a sample usage of the script:
Enter a YouTube video URL from youtube.com only: https://www.youtube.com/watch?v=video_id
--------------------------------------------------------------------------------------------------------------------------
Prompt (q to quit): How does the AI assistant work?
Answer: The AI assistant retrieves the video transcript from the specified YouTube URL and generates responses depending on the transcript content.
--------------------------------------------------------------------------------------------------------------------------
Prompt (q to quit): q