API Enterprise SDK
YouTube Bot

YouTube Bot Enterprise SDK

The YouTube Bot SDK allows you to fetch, transcribe, index, and query public YouTube video content. This module is ideal for parsing learning materials, tutorial videos, reviews, and corporate recordings.


Technical Overview

The YouTube Bot uses yt-dlp to download the audio track of the requested video link, converts it to standard transcript text, runs NLP summaries, and indexes the resulting chunks into a Vector database to support retrieval-augmented questions.


Key Endpoints

1. Start YouTube Processing (POST /youtubeStart)

Pass a YouTube video URL to begin downloading and transcribing its audio track.

  • Request Payload:

    • platformURL: String. The target YouTube video link (e.g. https://www.youtube.com/watch?v=...).
    • prompt: String. Prompt command settings mapping API key variables.
    • modeljsonStructure: String. Model JSON specifications configuration.
    • user_id: String. User account ID.
  • Response:

    {
      "combinedResponse": {
        "transcribed_text": "...audio transcript...",
        "Notes": "...key bulleted takeaways...",
        "Summary": "...high level summary...",
        "Session_Details": {
          "Session ID": "youtube-session-uuid-999",
          "text_file_path": "path/to/transcripts.txt"
        }
      }
    }

2. Generate Vector Index (POST /youtubeVectorApi)

Indexes the transcribed video segments for keyword/semantic searches.

  • Request Payload:

    • filename: String. The YouTube Session ID returned by youtubeStart.
    • prompt: String command configuration.
    • modeljsonStructure: String model embedding parameters.
  • Response:

    {
      "message": "Vector DB generated successfully"
    }

3. Query YouTube Content (POST /youtubeChatApi)

Retrieves answers derived directly from the YouTube video transcription content.

  • Request Payload:

    • uuId: String. YouTube Session ID.
    • userMessage: String. Question query about the video.
  • Response:

    {
      "answer": "According to the speaker, the target budget is $25k."
    }

Code Example: Integrating YouTube SDK

Here is a Python integration demonstrating how to execute YouTube video parsing and conversation:

import requests
 
API_URL = "http://localhost:5001/api"
 
# 1. Start YouTube Processing
response = requests.post(f"{API_URL}/youtubeStart", json={
    "platformURL": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "user_id": "dev_user_02",
    "prompt": "\"aih_key\" \"{params}\" \"url\" \"openai_key\"",
    "modeljsonStructure": '{"temperature": 0.0}'
})
data = response.json()
session_id = data["combinedResponse"]["Session_Details"]["Session ID"]
print("Transcribed Video Text:", data["combinedResponse"]["transcribed_text"])
 
# 2. Build Vector Index
vector_res = requests.post(f"{API_URL}/youtubeVectorApi", json={
    "filename": session_id,
    "prompt": "Create index",
    "modeljsonStructure": "{}"
})
print(vector_res.json()["message"])
 
# 3. Query Video Content
query_res = requests.post(f"{API_URL}/youtubeChatApi", json={
    "uuId": session_id,
    "userMessage": "What are the core arguments presented in this video?"
})
print("Answer:", query_res.json()["answer"])