Skip to main content

langchain-getyoutubetranscript

YouTube transcript tools and a document loader for LangChain, powered by the GetYouTubeTranscript API. Give agents the transcript of any YouTube video (optionally with [m:ss] timestamps) and YouTube search, or load transcripts into RAG pipelines.

The API fetches transcripts on its own servers, so it works from cloud servers and serverless functions without proxies, and without RequestBlocked / IpBlocked errors.

Install

pip install langchain-getyoutubetranscript

Get an API key at getyoutubetranscript.com/dashboard (free tier included) and set it:

export GETYOUTUBETRANSCRIPT_API_KEY=sk_live_...

Or pass api_key="..." to any class.

Tools

Class Tool name What it does
GetYouTubeTranscriptTool youtube_transcript Transcript of a video (URL or ID) with title and channel. timestamps=True prefixes each line with [m:ss].
GetYouTubeTranscriptSearchTool youtube_search Search YouTube for videos or channels. Returns JSON with a continuation_token for the next page.
from langchain_getyoutubetranscript import GetYouTubeTranscriptTool

tool = GetYouTubeTranscriptTool()
print(tool.invoke({"video": "https://youtu.be/jNQXAC9IVRw", "timestamps": True}))
# Title: Me at the zoo
# Channel: jawed
# Language: en
#
# [0:01] All right, so here we are, in front of the elephants
# ...

API errors (no captions, invalid video, out of credits) come back to the agent as a short message instead of raising.

With an agent

from langchain.agents import create_agent
from langchain_getyoutubetranscript import GetYouTubeTranscriptSearchTool, GetYouTubeTranscriptTool

agent = create_agent(
    model="anthropic:claude-sonnet-4-5",
    tools=[GetYouTubeTranscriptSearchTool(), GetYouTubeTranscriptTool()],
)
agent.invoke(
    {"messages": [{"role": "user", "content": "Find a short talk on transformers and summarize it with timestamps."}]}
)

Document loader

from langchain_getyoutubetranscript import GetYouTubeTranscriptLoader

docs = GetYouTubeTranscriptLoader(
    ["https://youtu.be/jNQXAC9IVRw", "5e37ZT3SQbk"],
    language="en",
    timestamps=False,
).load()

print(docs[0].metadata)
# {'source': 'https://www.youtube.com/watch?v=jNQXAC9IVRw', 'video_id': 'jNQXAC9IVRw',
#  'title': 'Me at the zoo', 'author_name': 'jawed', 'language_code': 'en', 'word_count': 39}

One Document per video. With timestamps=True, page_content is [m:ss] lines and metadata["segments"] holds {start, duration, text} per caption line (seconds).

Pricing

Each transcript or search request uses one credit from your GetYouTubeTranscript account. Failed requests are not charged.

Development

pip install -e ".[test]"
pytest                                        # unit + LangChain standard tests, no network
GETYOUTUBETRANSCRIPT_API_KEY=... pytest tests/integration_tests   # live, spends credits

Metadata

Release files for langchain-getyoutubetranscript 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-getyoutubetranscript 0.1.0
File Size Uploaded
langchain_getyoutubetranscript-0.1.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-getyoutubetranscript 0.1.0
File Interpreter ABI Platform
langchain_getyoutubetranscript-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / langchain_getyoutubetranscript-0.1.0.tar.gz

Download URL langchain_getyoutubetranscript-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
24215a8b62867c0aa9ffa75fee47ac43043a960b04509a5b28db74ab68e2b1d4
BLAKE2b-256 checksum
How to use checksums
86bb77393195dd68445586822507d8832acff0f6e85d43822cd966c50dd1fb98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / langchain_getyoutubetranscript-0.1.0-py3-none-any.whl

Download URL langchain_getyoutubetranscript-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3492cf6c546c334a65915438dd1d9fb9d796b7863e5d72c1aa276e5859a6711
BLAKE2b-256 checksum
How to use checksums
61de4d5a4c3812b9ffadfd4a33e5ec6d8c4768804618a21842887bdb0ec5b806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page