langchain-importly
A LangChain document loader for video and audio links. Give it links from YouTube, TikTok, X, Instagram, a podcast or 1,000+ other sites, and get transcript Documents with the title, duration, source URL and per-chunk timestamps.
It runs on the Importly API, so it keeps working once your app is deployed: from servers, serverless functions, Hugging Face Spaces and agent sandboxes, where video sites usually block downloads. Free to try, no card required.
Install
pip install -U langchain-importly
export IMPORTLY_API_KEY=... # https://www.importly.io/login?mode=signup&utm_source=langchain&utm_medium=package&utm_campaign=guerrilla-2026-11
Use
from langchain_importly import ImportlyLoader
loader = ImportlyLoader(
[
"https://www.youtube.com/watch?v=jNQXAC9IVRw",
"https://vimeo.com/76979871",
],
transcript_format="chunks", # "text" (default), "chunks" or "segments"
chunk_size_seconds=60,
mode="auto", # captions, or speech-to-text for links without them
)
docs = loader.load() # or: await loader.aload(), loader.lazy_load()
docs[0].metadata
# {'source': 'https://www.youtube.com/watch?v=jNQXAC9IVRw', 'url': '...', 'job_id': '...',
# 'language': 'en', 'transcript_source': 'platform_captions', 'duration': 19.0,
# 'title': 'Me at the zoo', 'thumbnail': '...', 'chunk_index': 0,
# 'start_seconds': 1.2, 'end_seconds': 14.367, 'start_timestamp': '00:00:01', 'end_timestamp': '00:00:14'}
Then split, embed and store them like any other documents. With "chunks", every piece keeps its start and end time, so your app can cite or link to the moment an answer came from.
Options
| Option |
Default |
What it does |
transcript_format |
"text" |
One Document per link, per ~chunk_size_seconds window, or per caption segment |
chunk_size_seconds |
120 |
Window length for "chunks" (segments are never split) |
language |
captions' default |
Two-letter code, e.g. "es" |
mode |
None (captions only) |
"auto": captions, or speech-to-text (billed per minute) for links without them. "captions": never speech-to-text. "ai": always speech-to-text |
provider |
None |
Speech-to-text provider; "importly" is built in. Without mode, setting it transcribes every link, even ones with captions |
max_cost_dollars |
None |
Cap per link for speech-to-text |
include_metadata |
True |
Adds title and thumbnail (one extra $0.003 call per link) |
continue_on_failure |
False |
Log and skip links that fail (private, removed, no captions) instead of raising |
max_concurrency |
4 |
Links in flight at once, in load / lazy_load and aload / alazy_load |
api_key |
IMPORTLY_API_KEY |
|
By default transcripts come from the media's captions ($0.003 per link). For media without captions, the loader raises importly.TranscriptionProviderRequiredError with a price quote; set mode="auto" to transcribe the audio of those links instead ($0.01 per minute), and max_cost_dollars to cap each one. Media with no speech at all (a music-only clip) gives no Documents and logs a warning.
Need the file or full metadata too? The same key works with the importly SDK: Importly().import_media(url) returns a download link.
Links
MIT licensed.