Get your dream built 10x faster

How to integrate YouTube Summarizer with OpenClaw

We build custom applications 5x faster and cheaper 🚀

Book a Free Consultation
4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Stuck on an error? Book a 30-minute call with an engineer and get a direct fix + next steps. No pressure, no commitment.

How to integrate YouTube Summarizer with OpenClaw

Integrate a YouTube Summarizer with OpenClaw by building a small, authenticated external summarization service (fetches transcripts, chunks them, calls an LLM), hosting it with TLS and an API key or OAuth, then installing a thin OpenClaw skill via ClawHub that calls that service. Keep heavy or stateful work (transcript storage, long-running jobs, retries) outside the agent runtime; the agent should make simple REST calls and return structured results. Configure authentication (YouTube OAuth if you need private captions, OpenAI or LLM credentials for summarization, and a service API key for the OpenClaw-to-service call) in ClawHub as credentials/environment variables, and then test and debug by checking logs, API responses, token scopes, and skill invocation traces.

 

Overview: components and responsibilities

 

  • External summarization service (required) — Responsible for pulling YouTube transcripts (public or private), chunking text, calling an LLM provider to summarize, and exposing a small authenticated REST API (e.g., POST /summarize).
  • LM provider & credentials — API key or OAuth for the model you use (OpenAI, Anthropic, etc.). Stored as environment variables or in a secrets store; the external service uses them.
  • YouTube access — Public transcripts can often be retrieved without OAuth using transcript scraping libraries; private captions require OAuth and appropriate YouTube Data API scopes (for private data use the official Google OAuth flow with youtube.readonly or captions scopes as required).
  • OpenClaw skill (thin) — Deployed via ClawHub; authenticates to your external service (API key or signed token from ClawHub secrets) and simply forwards user input (YouTube URL, options) and returns the response to callers.
  • Operational pieces (outside the agent) — Storage, queuing, retry/backoff, long jobs, and logs should be hosted externally (cloud functions, web servers, message queues, DBs).

 

Concrete external service example (working Python Flask)

 

This example is a practical external HTTP service you host. It:

  • Accepts POST /summarize with {"youtube\_url":"..."}.
  • Obtains the transcript using youtube_transcript_api.
  • Chunks the transcript and summarizes each chunk via OpenAI’s chat completions API.
  • Combines chunk summaries into a final concise summary and returns JSON.

Install dependencies:

# <b>//</b> install packages
pip install flask youtube-transcript-api openai
from flask import Flask, request, jsonify
from youtube_transcript_api import YouTubeTranscriptApi
import openai
import os
import re
import math

app = Flask(__name__)
openai.api_key = os.environ.get("OPENAI_API_KEY")  # <b>//</b> set this in environment

def extract_video_id(url_or_id):
    # accepts a raw id or a full YouTube URL
    m = re.search(r"(?:v=|\/)([0-9A-Za-z_-]{11})", url_or_id)
    if m:
        return m.group(1)
    if re.fullmatch(r"[0-9A-Za-z_-]{11}", url_or_id):
        return url_or_id
    raise ValueError("Invalid YouTube URL or ID")

def chunk_text(text, max_chars=3000):
    # naive character-based chunking; tune for tokens if needed
    chunks = []
    start = 0
    while start < len(text):
        end = min(start + max_chars, len(text))
        chunks.append(text[start:end])
        start = end
    return chunks

@app.route("/summarize", methods=["POST"])
def summarize():
    data = request.get_json() or {}
    youtube_url = data.get("youtube_url")
    if not youtube_url:
        return jsonify({"error": "youtube_url required"}), 400

    try:
        video_id = extract_video_id(youtube_url)
    except ValueError:
        return jsonify({"error": "invalid youtube url or id"}), 400

    # <b>//</b> Fetch transcript (may throw if not available)
    try:
        transcript_parts = YouTubeTranscriptApi.get_transcript(video_id)
    except Exception as e:
        return jsonify({"error": "transcript_unavailable", "details": str(e)}), 500

    full_text = " ".join(part.get("text", "") for part in transcript_parts).strip()
    if not full_text:
        return jsonify({"error": "empty_transcript"}), 500

    # <b>//</b> Chunk and summarize each chunk with the LLM
    chunks = chunk_text(full_text, max_chars=3000)
    chunk_summaries = []
    for c in chunks:
        resp = openai.ChatCompletion.create(
            model="gpt-3.5-turbo",
            messages=[
                {"role": "system", "content": "You are a concise summarization assistant. Produce short bullet-point summaries and a single-paragraph concise summary."},
                {"role": "user", "content": f"Summarize the following transcript chunk:\n\n{c}"}
            ],
            max_tokens=500,
            temperature=0.2
        )
        text = resp["choices"][0]["message"]["content"].strip()
        chunk_summaries.append(text)

    # <b>//</b> Combine chunk summaries into final summary
    combine_prompt = "Combine these chunk summaries into a final concise summary (first a single-paragraph summary, then 3 bullets with key takeaways):\n\n" + "\n\n---\n\n".join(chunk_summaries)
    final_resp = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": "You are a concise summarization assistant."},
            {"role": "user", "content": combine_prompt}
        ],
        max_tokens=600,
        temperature=0.2
    )
    final_summary = final_resp["choices"][0]["message"]["content"].strip()

    return jsonify({"summary": final_summary, "video_id": video_id})

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)

 

Sample request to the external service

 

curl -X POST "https://your-service.example.com/summarize" \
  -H "Authorization: Bearer YOUR_SERVICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"youtube_url":"https://www.youtube.com/watch?v=VIDEO_ID"}'

 

How to wire this into OpenClaw (ClawHub + skill)

 

  • Create the external service and host it — Deploy with HTTPS, put an API key in the service (or use OAuth). Store that API key in a secure place (cloud secret manager).
  • Register credentials in ClawHub — Use ClawHub’s secure inputs or secrets mechanism (do not hard-code keys in the skill). Provide the external service URL and API key to the skill as environment variables or secrets.
  • Implement a thin OpenClaw skill — The skill should accept high-level inputs (YouTube URL, summarization options) and make a single authenticated HTTP POST to your external service, then return the JSON result. Keep the skill simple: no heavy transcript scraping or LLM calls inside the agent runtime.
  • Permissions and auth — If your external service requires an API key, send it in Authorization: Bearer or a custom header. If YouTube private data is needed, perform OAuth on your external service or via ClawHub’s OAuth setup and ensure the token is stored/revoked/rotated properly.
  • Install/configure the skill via ClawHub — Upload the skill manifest/code, bind environment variables from secrets (external service URL, service API key), and grant the skill only the minimum permissions it needs.

 

When to use YouTube Data API / OAuth vs. scraping transcripts

 

  • Public auto-generated captions — You can often use scraping libraries (youtube-transcript-api in Python) to get transcripts without OAuth. This is simpler but less reliable for private videos or some region-restricted content.
  • Private captions or channel-owned captions — Use Google OAuth and the YouTube Data API with the appropriate scopes (for viewing private videos/captions you need user consent; common scope: https://www.googleapis.com/auth/youtube.readonly). Implement the OAuth flow on the external service or via a separate auth component; store refresh tokens securely.
  • Respect rate limits — The YouTube Data API has quotas; the scraping approach may be rate-limited by YouTube. Design caching and backoff in your external layer.

 

Design & reliability considerations (what belongs outside the agent)

 

  • Run transcripts & model calls externally — LLM calls and transcript fetching are I/O-heavy and possibly long-running; the OpenClaw agent should only orchestrate and call a REST endpoint.
  • Persistence — Store transcripts, intermediate summaries, errors, and job status in an external DB if you need auditability or re-use.
  • Long-running jobs — If summarization may exceed agent time limits, provide an async job interface (POST returns job\_id, you poll GET /jobs/{id}). Use queues (SQS, Pub/Sub) and workers to scale.
  • Observability — Emit structured logs and request IDs. In the skill, pass a request ID header so you can correlate OpenClaw skill invocations with external service logs.

 

Testing and debugging checklist

 

  • Verify credentials — Ensure OPENAI_API_KEY (or other LLM keys), YouTube OAuth tokens (if used), and the service API key are correctly set in environment/secrets.
  • Check scopes — If private captions fail, confirm the OAuth scope covers the operation (youtube.readonly / captions as required) and that refresh tokens are valid.
  • Test external service independently — Call /summarize directly with curl and confirm transcript retrieval and LLM summarization work end-to-end.
  • Watch logs — External service logs should show transcript fetch results, LLM API responses, durations, and errors. Correlate with OpenClaw skill logs from ClawHub.
  • Validate API responses — Return structured errors (HTTP 4xx/5xx, JSON error codes) so the skill can display clear messages to users.
  • Rate limits and retries — Implement exponential backoff for transient LLM or YouTube API failures; surface permanent failures clearly to the skill caller.

 

Security checklist

 

  • Use HTTPS — External service must be TLS-protected.
  • Authenticate calls from OpenClaw — Use short-lived tokens or an API key stored in ClawHub secrets. Rotate keys periodically.
  • Least privilege — Grant YouTube OAuth scopes only for the data needed. Grant the skill only the secrets/vars it needs.
  • Validate webhooks & inputs — If your external service offers callbacks, validate signatures and origins.

Book Your Free 30‑Minute Migration Call

Speak one‑on‑one with a senior engineer about your no‑code app, migration goals, and budget. In just half an hour you’ll leave with clear, actionable next steps—no strings attached.

Book a Free Consultation

Troubleshooting YouTube Summarizer and OpenClaw Integration

1

OpenClaw Connector returns 403 when calling YouTube Data API for transcripts — how to resolve authentication, scopes, or quota issues?

Direct answer: a 403 from the OpenClaw Connector calling YouTube transcripts usually means wrong auth type, missing OAuth scopes, denied ownership/permissions, or quota. Switch from an API key to OAuth2, request the correct YouTube scopes, re-consent the user, ensure the authenticated account can access the video's captions, and inspect the API error body for the exact reason.

 

Troubleshoot and fix

 
  • Use OAuth not API key: captions require user credentials (client_id/secret + refresh token).
  • Check scopes: request appropriate YouTube Data scopes and re-consent so token includes them.
  • Verify ownership/visibility: private captions need the video owner or proper channel permissions.
  • Inspect error body: Google returns a reason (e.g., quotaExceeded, forbidden).
  • OpenClaw setup: confirm env vars, skill OAuth credentials, and refresh token are installed in ClawHub and available to the agent.

Quick token inspect

```bash // inspect access token scopes curl "https://oauth2.googleapis.com/tokeninfo?access_token=ya29._TOKEN" ```

2

How to register YouTube Summarizer as an external plugin in OpenClaw (openclaw.yaml/openclaw.json) so it appears in Pipelines and is selectable in the OpenClaw CLI?

 

Direct answer

 

Add a declarative entry for the YouTube Summarizer in your openclaw.yaml or openclaw.json under the project’s plugins/skills section: give it an id, display name, endpoint (the external service URL or OpenClaw-hosted skill endpoint), auth configuration that points to environment-variable names for API keys/OAuth, an inputs/outputs schema, and a flag to expose it to Pipelines and the CLI.

 

Example config

 

YAML snippet you can adapt:

plugins:
  - id: youtube-summarizer
    name: YouTube Summarizer
    description: Summarize YouTube video transcripts
    type: external
    endpoint: https://you-summarizer.example.com/v1/summarize
    auth:
      type: api_key
      env: YT_SUMMARIZER_API_KEY
    schemas:
      input: ./schemas/ytsummarizer-input.json
      output: ./schemas/ytsummarizer-output.json
    pipeline_enabled: true
    cli_visible: true

 

Notes

 
  • Ensure credentials are set as env vars (example: YT_SUMMARIZER_API_KEY) before running the runtime.
  • Expose correct scopes/permissions so agents can invoke the external endpoint.
  • Test by calling the endpoint directly and via the OpenClaw CLI to confirm it appears in Pipelines.

3

OpenClaw Agent fails with ModuleNotFoundError for youtube_summarizer after installing the integration — how to update OpenClaw plugin path, PYTHONPATH, or restart procedure to load new plugins?

Direct answer: Make sure the new skill package is installed into the exact Python environment the OpenClaw agent runtime uses, or add the package folder to the agent's PYTHONPATH, then restart the agent process so the runtime reloads sys.path and imports the new module.

 

Practical steps

 
  • Confirm interpreter: run the runtime's Python and print sys.path to see where it loads modules.
  • Install into that env: use pip in the same interpreter (virtualenv, venv, or container).
  • Or set PYTHONPATH: export PYTHONPATH=/path/to/your/plugins:$PYTHONPATH in the agent's service env.
  • Restart runtime: restart the agent process (systemd unit, container, or runtime manager) so new modules are discoverable; then check logs for ModuleNotFoundError details.

4

How to map YouTube Summarizer JSON output to the OpenClaw schema using a Transform/Schema Adapter so summaries populate the record 'summary' field and pass validation?

 

Direct answer

 

Write a Transform/Schema Adapter that extracts the summary string from the YouTube Summarizer JSON, assigns it to the record's summary field, and returns the adapted object for OpenClaw's schema validator. Validate the adapted object against your record schema before returning so OpenClaw will accept it.

 

How to implement

 

Steps to follow:

  • Parse the incoming summarizer payload and find the canonical text (e.g., summaryText, summary, or concatenated segments).
  • Map that value to summary on the output record object.
  • Validate the output against your OpenClaw record schema (runtime validation step).
function transform(youtubeJson){
  <b>//</b> pick likely summary fields
  const summary = youtubeJson.summaryText || youtubeJson.summary || (youtubeJson.segments && youtubeJson.segments.map(s=>s.text).join('\n')) || '';
  <b>//</b> produce record shape OpenClaw expects
  return { summary };
}
Book a Free Consultation

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt


Recognized by the best

Trusted by 600+ businesses globally

From startups to enterprises and everything in between, see for yourself our incredible impact.

RapidDev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with.

They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

Arkady
CPO, Praction
Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost.

He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Donald Muir
Co-Founder, Arc
RapidDev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space.

They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Mat Westergreen-Thorne
Co-CEO, Grantify
RapidDev is an excellent developer for custom-code solutions.

We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Emmanuel Brown
Co-Founder, Church Real Estate Marketplace
Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 

This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Samantha Fekete
Production Manager, Media Production Company
The pSEO strategy executed by RapidDev is clearly driving meaningful results.

Working with RapidDev has delivered measurable, year-over-year growth. Comparing the same period, clicks increased by 129%, impressions grew by 196%, and average position improved by 14.6%. Most importantly, qualified contact form submissions rose 350%, excluding spam.

Appreciation as well to Matt Graham for championing the collaboration!

Michael W. Hammond
Principal Owner, OCD Tech

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â