{"id":32786627,"url":"https://github.com/muhammadusman-khan/youtube-chatbot","last_synced_at":"2026-04-13T03:47:11.491Z","repository":{"id":322128804,"uuid":"1088287287","full_name":"MuhammadUsman-Khan/youtube-chatbot","owner":"MuhammadUsman-Khan","description":"🎙️ An intelligent RAG-based chatbot that learns from any YouTube video you provide automatically transcribing, embedding, and answering your questions contextually.","archived":false,"fork":false,"pushed_at":"2025-11-02T17:51:04.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-02T19:19:00.134Z","etag":null,"topics":["ai","chatbot","embeddings","flask","gemini","llm","openai","rag","rag-chatbot","retrieval-augmented-generation","youtube"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MuhammadUsman-Khan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-02T17:19:27.000Z","updated_at":"2025-11-02T17:55:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/MuhammadUsman-Khan/youtube-chatbot","commit_stats":null,"previous_names":["muhammadusman-khan/youtube-chatbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/MuhammadUsman-Khan/youtube-chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MuhammadUsman-Khan%2Fyoutube-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MuhammadUsman-Khan%2Fyoutube-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MuhammadUsman-Khan%2Fyoutube-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MuhammadUsman-Khan%2Fyoutube-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MuhammadUsman-Khan","download_url":"https://codeload.github.com/MuhammadUsman-Khan/youtube-chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MuhammadUsman-Khan%2Fyoutube-chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282762578,"owners_count":26723111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-05T02:00:05.946Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatbot","embeddings","flask","gemini","llm","openai","rag","rag-chatbot","retrieval-augmented-generation","youtube"],"created_at":"2025-11-05T05:01:28.841Z","updated_at":"2026-04-13T03:47:11.479Z","avatar_url":"https://github.com/MuhammadUsman-Khan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTube Chatbot\n\nAn intelligent, fully dynamic Retrieval-Augmented Generation (RAG) chatbot that answers questions about any YouTube video you provide.  \nIt uses **OpenAI Whisper** for transcription, **OpenAI embeddings (small)** for semantic search, and **Gemini** for generating responses, all via API keys. No local models are required.\n\n---\n\n## 🚀 Key Features\n- **Dynamic YouTube Video Learning**: Enter any video URL and the bot automatically processes it.  \n- **Audio Conversion \u0026 Transcription**: Video is converted to audio, then transcribed using **OpenAI Whisper**.  \n- **JSON Storage**: Transcriptions are stored in JSON format for structured processing.  \n- **OpenAI Embeddings**: Transcript chunks are converted into embeddings for semantic retrieval.  \n- **User Query Matching**: Queries are converted into embeddings and matched using cosine similarity.  \n- **Gemini API Responses**: Generates context-aware answers based on the relevant transcript; replies with \"Information not available in the provided video\" if no match exists.  \n- **Flask Web Interface**: Interactive and user-friendly chat interface.\n\n---\n\n## 🛠️ Tech Stack\n- **Python 3**\n- **Flask** for web backend\n- **HTML/CSS/JS** for frontend templates\n- **OpenAI Whisper API** for transcription\n- **OpenAI Embeddings (small)** for vectorization\n- **Gemini API** for LLM responses\n- **Cosine Similarity** for Nearest neighbor search\n\n---\n\n## 📁 Project Structure\n\n```\nyoutube-chatbot/\n├── app.py \n├── backend/\n│ ├── embeddings.py \n│ ├── mp3_to_json.py \n│ ├── process_incomings.py\n│ └── yt_to_mp3.py \n├── templates/ \n│ └── index.html \n├── static/ \n│ ├── style.css \n│ └── script.js \n├── requirements.txt \n└── README.md\n```\n\n\n---\n\n## 🧭 How It Works\n1. User provides a **YouTube URL**.  \n2. Video is converted to **audio** using `yt_to_mp3.py`.  \n3. Audio is transcribed via **OpenAI Whisper** using `mp3_to_json.py` and stored as JSON.  \n4. Transcript chunks are converted into embeddings with `embeddings.py` using OpenAI Embeddings (small).  \n5. User query is also converted into embeddings.  \n6. **Cosine similarity** is computed between query and transcript embeddings via `process_incomings.py`.  \n7. The most relevant transcript chunk is sent to **Gemini API** for a response.  \n8. If no relevant information exists, the bot replies:  \n   \u003e \"Information not available in the provided video.\"  \n9. Response is displayed in the Flask web UI (`index.html`).\n\n---\n\n## 📌 Setup Instructions\n1. Clone the repository:\n```\ngit clone https://github.com/MuhammadUsman-Khan/youtube-chatbot.git\ncd youtube-chatbot\n```\n2. Install dependencies:\n```\npip install -r requirements.txt\n\n```\n\n3. Set environment variables for API keys:\n```\nexport OPENAI_API_KEY=\"your_openai_key\"\nexport GEMINI_API_KEY=\"your_gemini_key\"\n\n```\n\n4. Run the Flask app:\n```\npython app.py\n\n```\n\n5. Open your browser at http://127.0.0.1:5000/ and start chatting with the bot.\n\n---\n\n## 📌 requirements.txt\n\n```\nFlask==3.1.2\nimageio_ffmpeg==0.6.0\njoblib==1.5.0\nnumpy==2.3.4\nopenai==2.7.1\nopenai_whisper==20250625\npandas==2.3.3\npython-dotenv==1.2.1\nRequests==2.32.5\nscikit_learn==1.7.2\n```\n\n## ✅ Notes \u0026 Improvements\n\n- Fully dynamic; no local models required.\n\n- Transcript quality depends on YouTube captions and audio clarity.\n\n- Reduce Time Complexity and make it faster.\n\n- Frontend can be enhanced with chat history, typing indicators, and UI themes.\n\n## 🤝 Contributing\n\nFeel free to fork the repo, submit issues, or create pull requests. Contributions are welcome!\n\n## 🖊️ Author \u0026 Developer\n\n#### Muhammad Usman Khan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadusman-khan%2Fyoutube-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammadusman-khan%2Fyoutube-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammadusman-khan%2Fyoutube-chatbot/lists"}