Many videos at once
Research rarely stops at one video. This tutorial expands a YouTube playlist of G-Wagon buyer videos, turns videos into one document a model can read, and searches across them.
1. Expand a playlist
/items turns a playlist, a channel or a podcast feed into a list of video references. A single video lists as itself, so you can send any input through this step.
/api/v1/itemsExpand a playlistcurl -G https://vid2context.com/api/v1/items \
--data-urlencode 'url=https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b' \
--data-urlencode limit=5const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b',
limit: '5',
});
const res = await fetch(`${BASE}/api/v1/items?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(JSON.stringify(await res.json(), null, 2));import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"limit": "5",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/items?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(json.dumps(json.load(res), indent=2))
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}")npx -y vid2context list 'https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b' --limit 5 --json{
"name": "list_items",
"arguments": {
"url": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"limit": 5
}
}{
"items": [
{
"input": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"platform": "youtube",
"kind": "video",
"id": "youtube:PzJL3aBRas8",
"nativeId": "PzJL3aBRas8",
"url": "https://www.youtube.com/watch?v=PzJL3aBRas8"
},
{
"input": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"platform": "youtube",
"kind": "video",
"id": "youtube:1Xx1fmHIsiA",
"nativeId": "1Xx1fmHIsiA",
"url": "https://www.youtube.com/watch?v=1Xx1fmHIsiA"
},
{
"input": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"platform": "youtube",
"kind": "video",
"id": "youtube:AS6LYBzFtEU",
"nativeId": "AS6LYBzFtEU",
"url": "https://www.youtube.com/watch?v=AS6LYBzFtEU"
},
{
"input": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"platform": "youtube",
"kind": "video",
"id": "youtube:EO1PYUnXHiM",
"nativeId": "EO1PYUnXHiM",
"url": "https://www.youtube.com/watch?v=EO1PYUnXHiM"
},
{
"input": "https://www.youtube.com/playlist?list=PLHeawKfarQSPKIjpe86at3Ttc2sz7uD_b",
"platform": "youtube",
"kind": "video",
"id": "youtube:U7Dmgpp5W-Q",
"nativeId": "U7Dmgpp5W-Q",
"url": "https://www.youtube.com/watch?v=U7Dmgpp5W-Q"
}
]
}2. One pack for several videos
POST /pack takes a list of inputs and returns one Markdown document with every video's metadata, chapters and transcript, sized by maxTokens. Playlists in the list are expanded first. When one video fails, the others still go in, and the failure is listed under "Not included" so the model knows what is missing.
/api/v1/packOne pack for several videosPlaylists in inputs are expanded. A video that fails is listed under "Not included"; the rest still go in.
curl https://vid2context.com/api/v1/pack \
-H 'Content-Type: application/json' \
-d '{
"inputs": [
"https://www.youtube.com/watch?v=jNQXAC9IVRw",
"https://www.youtube.com/watch?v=cCPsdFdlshc"
],
"maxTokens": 3000
}'const BASE = 'https://vid2context.com';
const body = {
inputs: [
'https://www.youtube.com/watch?v=jNQXAC9IVRw',
'https://www.youtube.com/watch?v=cCPsdFdlshc',
],
maxTokens: 3000,
};
const res = await fetch(`${BASE}/api/v1/pack`, {
headers: { 'Content-Type': 'application/json' },
method: 'POST',
body: JSON.stringify(body),
});
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(await res.text());import json
import urllib.error
import urllib.request
BASE = "https://vid2context.com"
body = {
"inputs": [
"https://www.youtube.com/watch?v=jNQXAC9IVRw",
"https://www.youtube.com/watch?v=cCPsdFdlshc",
],
"maxTokens": 3000,
}
headers = {"Content-Type": "application/json"}
req = urllib.request.Request(f"{BASE}/api/v1/pack", data=json.dumps(body).encode(), headers=headers, method="POST")
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(res.read().decode())
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}")npx -y vid2context pack 'https://www.youtube.com/watch?v=jNQXAC9IVRw' 'https://www.youtube.com/watch?v=cCPsdFdlshc' --max-tokens 3000{
"name": "export_context_pack",
"arguments": {
"urls": [
"https://www.youtube.com/watch?v=jNQXAC9IVRw",
"https://www.youtube.com/watch?v=cCPsdFdlshc"
],
"maxTokens": 3000
}
}# Video context pack
This document holds the transcripts and metadata of 2 videos (18:23 in total), prepared by vid2context for an AI model to read. Each transcript paragraph starts with the time it begins in the video, in brackets; linked times open the video at that moment.
Citation rule: when you use something from a video, cite it as [Title @ m:ss](link), using the time and link of the paragraph you drew on (or [Title @ m:ss] when the video has no link).
Some content was left out to fit a budget of 3000 tokens. Each cut is marked where it happened.
## Contents
1. [Me at the zoo](#video-1-me-at-the-zoo) (0:19)
2. [Best & Worst G-Wagon Years: Reliability, Interiors & Engines Ranked!](#video-2-best--worst-g-wagon-years-reliability-interiors--engines-ranked) (18:04)
## Video 1: Me at the zoo
- Channel: [jawed](https://www.youtube.com/channel/UC4QobU6STFB0P71PMvOGN5A)
- Published: 2005-04-23
- Duration: 0:19
- Source: https://www.youtube.com/watch?v=jNQXAC9IVRw
- Language: en
- Transcript: creator captions from youtube-captions
### Description
> Microplastics are accumulating in human brains at an alarming rate
> https://www.youtube.com/watch?v=0PT5c1z3LL8
>
> “Nanoplastics and Human Health” with Matthew J Campen, PhD, MSPH
_Description shortened to 176 of 264 characters._
### Chapters
- [0:00](https://www.youtube.com/watch?v=jNQXAC9IVRw&t=0s) Intro
- [0:05](https://www.youtube.com/watch?v=jNQXAC9IVRw&t=5s) The cool thing
- [0:17](https://www.youtube.com/watch?v=jNQXAC9IVRw&t=17s) End
### Transcript
> The whole transcript, 0:01 to 0:18, is omitted for length. Fetch it with the get_section tool or the full transcript.
## Video 2: Best & Worst G-Wagon Years: Reliability, Interiors & Engines Ranked!
- Channel: [Alliance Motorworks](https://www.youtube.com/channel/UCdEjP_BjQ5audhxLKKzZl2A)
- Published: 2025-03-09
- Duration: 18:04
- Source: https://www.youtube.com/watch?v=cCPsdFdlshc
- Language: en
- Transcript: speech-to-text by stt/cloudflare/@cf/openai/whisper-large-v3-turbo
### Description
> Watch this side-by-side comparison of G-Wagons from 2000 - 2018 to rank the best and worst for interiors, engines, and reliability. This is part 1 of a multi-video series for buying and building your
_Description shortened to 199 of 799 characters._
### Chapters
- [0:00](https://www.youtube.com/watch?v=cCPsdFdlshc&t=0s) G wagon buying guide
- [1:05](https://www.youtube.com/watch?v=cCPsdFdlshc&t=65s) G500 m113 engine overview
- [2:04](https://www.youtube.com/watch?v=cCPsdFdlshc&t=124s) G500 interior and features
- [4:12](https://www.youtube.com/watch?v=cCPsdFdlshc&t=252s) G55 AMG specs and history
- [5:50](https://www.youtube.com/watch?v=cCPsdFdlshc&t=350s) G55 interior and technology
- [8:25](https://www.youtube.com/watch?v=cCPsdFdlshc&t=505s) Best G-Wagon for your budget
- [9:39](https://www.youtube.com/watch?v=cCPsdFdlshc&t=579s) G550 technological leap
- [12:27](https://www.youtube.com/watch?v=cCPsdFdlshc&t=747s) 2016-2018 G-Wagon updates
- [14:01](https://www.youtube.com/watch?v=cCPsdFdlshc&t=841s) Final recommendations
### Transcript
#### G wagon buying guide (0:00)
[0:00](https://www.youtube.com/watch?v=cCPsdFdlshc&t=0s) So you're going to buy a G-Wagon. Which year is best for you? Well, in this video, we're going to do a year-by-year breakdown of the legendary W463 platform, so you can check out the model year ranges, the engine options, and the interior, because if you buy the wrong one, I don't want you getting buyer's remorse or ending up with a bad specimen. My name's Adam. Welcome to the G-Wheel and YouTube channel. I do everything here for the love of G. I'm joined by Joe from Alliance Auto Care. He is the G-Wagon specialist and helped me produce not only these videos, but also the ultimate build and buyer's guide for the G-Wagon. So if you're in the market, click the link in the description right now. Joe, thanks for being here, man.
[0:39] All right. Let's get into it. Let's rock and roll. Let's introduce each one of these three trucks. We're going to hit the year range, the engine options, and give you an interior tour. Let's rock and roll. Cool. We have three trucks here. Starting with our first one, we have a 2000 G500. The second one is a 2012 G55 AMG. The third one is a 2015 G550. We're going to walk through and look at some of the engine options real quick. On the first one, the 2000 G500. Now, there's a couple of models prior to this one, but this is kind of the one everyone gravitates to.
#### G500 m113 engine overview (1:05)
[1:09] This one has what we know the legendary M113 V8. This was Mercedes' big hurrah into the V8s, and this is arguably one of their most reliable V8s out there. Some call it the Land Cruiser Killer. Yeah, it is known as the Land Cruiser Killer. I really like this motor. It's all aluminum. It's super light, and it is as reliable as it gets. Now, some of the key things. It's a single overhead cam motor. It's timing chains. It's two spark plugs per cylinder, and it makes 300 horsepower and 300 foot-pounds of torque. Nice round numbers.
22 more lines not shown. Run it to see the whole response.
3. Every format in a zip
/bundle returns a zip: context.md (the pack), the transcript in each format you ask for, the metadata, and a README that tells an agent what each file is. The block lists the files; when you run it, Download saves the zip.
/api/v1/bundleEvery format in a zipcontext.md is always in the zip, next to one file per format, the metadata and a README for agents.
curl -OJ -G https://vid2context.com/api/v1/bundle \
--data-urlencode 'url=https://www.youtube.com/watch?v=jNQXAC9IVRw'import { writeFile } from 'node:fs/promises';
const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
url: 'https://www.youtube.com/watch?v=jNQXAC9IVRw',
});
const res = await fetch(`${BASE}/api/v1/bundle?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
await writeFile('bundle.zip', Buffer.from(await res.arrayBuffer()));
console.log('Saved bundle.zip');import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/bundle?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
with open("bundle.zip", "wb") as f:
f.write(res.read())
print("Saved bundle.zip")
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}")npx -y vid2context bundle 'https://www.youtube.com/watch?v=jNQXAC9IVRw' -o bundle.zip10 files, 7419 bytes
2536 me-at-the-zoo/README.md
1642 me-at-the-zoo/context.md
218 me-at-the-zoo/transcript.txt
3608 me-at-the-zoo/context.json
936 me-at-the-zoo/transcript.md
415 me-at-the-zoo/transcript.srt
534 me-at-the-zoo/transcript.vtt
1886 me-at-the-zoo/metadata.json
254 me-at-the-zoo/chapters.md
1757 me-at-the-zoo/manifest.jsonPOST /bundle takes the same inputs list as POST /pack for a zip of many videos.
4. Find a topic across videos
POST /research finds where words come up in each video and returns ranked excerpts with the surrounding context and timestamp links. It reads the videos itself, so it needs nothing saved first.
/api/v1/researchFind a topic across videosRanked excerpts with context and timestamp links. Needs no saved library.
curl https://vid2context.com/api/v1/research \
-H 'Content-Type: application/json' \
-d '{
"urls": [
"https://www.youtube.com/watch?v=cCPsdFdlshc"
],
"query": "reliability",
"maxExcerpts": 3
}'const BASE = 'https://vid2context.com';
const body = {
urls: [
'https://www.youtube.com/watch?v=cCPsdFdlshc',
],
query: 'reliability',
maxExcerpts: 3,
};
const res = await fetch(`${BASE}/api/v1/research`, {
headers: { 'Content-Type': 'application/json' },
method: 'POST',
body: JSON.stringify(body),
});
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(JSON.stringify(await res.json(), null, 2));import json
import urllib.error
import urllib.request
BASE = "https://vid2context.com"
body = {
"urls": [
"https://www.youtube.com/watch?v=cCPsdFdlshc",
],
"query": "reliability",
"maxExcerpts": 3,
}
headers = {"Content-Type": "application/json"}
req = urllib.request.Request(f"{BASE}/api/v1/research", data=json.dumps(body).encode(), headers=headers, method="POST")
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(json.dumps(json.load(res), indent=2))
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}"){
"name": "research_videos",
"arguments": {
"urls": [
"https://www.youtube.com/watch?v=cCPsdFdlshc"
],
"query": "reliability",
"maxExcerpts": 3
}
}{
"query": "reliability",
"terms": [
"reliability"
],
"phrases": [],
"results": [
{
"videoId": "youtube:cCPsdFdlshc",
"title": "Best & Worst G-Wagon Years: Reliability, Interiors & Engines Ranked!",
"channel": "Alliance Motorworks",
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc",
"durationSec": 1084,
"origin": "stt",
"language": "en",
"transcriptTokens": 5163,
"excerpts": [
{
"startSec": 612.34,
"endSec": 626.76,
"timestamp": "[10:12]",
"text": "I think they're very reliable. They make the right amount of power for big stuff. They make the right noises and they're very reliable. I have yet to see anything catastrophic go wrong with one of these. And I say that because we work on a ton of these and they are super reliable.",
"context": {
"before": "They actually started this motor in 2011 in the G550 and then kept it all the way through the 2015 model year. This is the last hurrah for the naturally aspirated 5-mile liter V8. 13 to 15 is the year range for this generation, yes? Yep. This generation. You can still get this motor in the prior generation through 2011 and 2012, but for this interior and so forth. This is a great motor. I love this motor.",
"after": "With that, the other thing aside from the motor that is a huge technological leap forward, it's going to be your transmission. You got away from the 5-speed automatic and you go to a 7-speed automatic. I think that's just as much of a game changer in the way the truck handles and drives as the motor because it always keeps it in the right gear. And it's just, it is light years forward of where we came from. So that's on the mechanical side of things.",
"fromSec": 589.74,
"toSec": 647.64
},
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc&t=612s",
"score": 2.315,
"matched": [
"reliability"
]
},
{
"startSec": 994.9,
"endSec": 999.72,
"timestamp": "[16:34]",
"text": "And reliability. That's it. Anything that's portion of induction is extra complexity. Yeah. Reliability.",
"context": {
"before": "And I will say, for those that do want to go wheeling, I find that this in 4Low, compared to the 4L bi-turbo in 4Low, this is less twitchy on the throttle. Yes, yes, agreed. And you don't have, there's, I really prefer the naturally aspirated engine off-road. There's no turbo lag. Right. It's less twitchy. It's beautiful. Same. Yep. Totally agree there.",
"after": "And with an exhaust, it's louder. This sounds so pretty good. It sounds so good. We'll do that for another day. So anyway, Joe, anything to add on this series of which G-Wagon someone should end up with? I think we covered it all. Yeah. You have to know what your endgame is. If you want something that you, you've got a few extra dollars to spend, you want something really nice you can live with on a daily basis and just feel impressed every time you get in, grab one of these.",
"fromSec": 972.32,
"toSec": 1021.18
},
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc&t=994s",
"score": 2.173,
"matched": [
"reliability"
]
},
{
"startSec": 69.5,
"endSec": 90.38,
"timestamp": "[1:09]",
"text": "This one has what we know the legendary M113 V8. This was Mercedes' big hurrah into the V8s, and this is arguably one of their most reliable V8s out there. Some call it the Land Cruiser Killer. Yeah, it is known as the Land Cruiser Killer. I really like this motor. It's all aluminum. It's super light, and it is as reliable as it gets.",
"context": {
"before": "Cool. We have three trucks here. Starting with our first one, we have a 2000 G500. The second one is a 2012 G55 AMG. The third one is a 2015 G550. We're going to walk through and look at some of the engine options real quick. On the first one, the 2000 G500. Now, there's a couple of models prior to this one, but this is kind of the one everyone gravitates to.",
"after": "Now, some of the key things. It's a single overhead cam motor. It's timing chains. It's two spark plugs per cylinder, and it makes 300 horsepower and 300 foot-pounds of torque. Nice round numbers. Yeah. It looks simple. It's neat. It's clean. Most importantly, it's easy to work on. Parts are cheap, and parts are available almost everywhere. This is what we call a global motor.",
"fromSec": 47.02,
"toSec": 111.86
},
"url": "https://www.youtube.com/watch?v=cCPsdFdlshc&t=69s",
"score": 1.994,
"matched": [
"reliability"
]
}
]
}
],
"failed": [],
"tokens": 1027,
"transcriptTokens": 5163,
"truncated": false,
"notes": []
}5. Search everything you have read
Every video a request has read is saved in the server's library. /search searches all of them at once, with "exact phrases" and -excluded words.
/api/v1/searchSearch saved transcriptsSearches the library: every video a request above has read is saved there.
curl -G https://vid2context.com/api/v1/search \
--data-urlencode q=elephants \
--data-urlencode limit=5const BASE = 'https://vid2context.com';
const params = new URLSearchParams({
q: 'elephants',
limit: '5',
});
const res = await fetch(`${BASE}/api/v1/search?${params}`);
if (!res.ok) {
const { error } = await res.json();
throw new Error(`${error.code}: ${error.message} ${error.hint ?? ''}`);
}
console.log(JSON.stringify(await res.json(), null, 2));import json
import urllib.error
import urllib.parse
import urllib.request
BASE = "https://vid2context.com"
params = urllib.parse.urlencode({
"q": "elephants",
"limit": "5",
})
headers = {}
req = urllib.request.Request(f"{BASE}/api/v1/search?{params}", headers=headers)
try:
with urllib.request.urlopen(req, timeout=300) as res:
print(json.dumps(json.load(res), indent=2))
except urllib.error.HTTPError as err:
error = json.load(err)["error"]
raise SystemExit(f"{error['code']}: {error['message']} {error.get('hint', '')}")npx -y vid2context search elephants --limit 5{
"name": "search_transcript",
"arguments": {
"query": "elephants",
"limit": 5
}
}{
"hits": [
{
"videoId": "youtube:jNQXAC9IVRw",
"title": "Me at the zoo",
"startSec": 1.2,
"endSec": 3.36,
"text": "All right, so here we are, in front of the elephants",
"score": 0.01639344262295082,
"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw&t=1s",
"chapterTitle": "Intro",
"sources": [
"keyword"
],
"snippet": "All right, so here we are, in front of the **elephants**",
"channel": "jawed",
"ranks": {
"keyword": 1
}
}
],
"meta": {
"query": {
"text": "elephants",
"phrases": [],
"excluded": []
},
"mode": "hybrid",
"keyword": {
"ran": true,
"backend": "storage",
"candidates": 1
},
"vector": "partial",
"rerank": "off",
"fusion": {
"k": 60,
"keywordWeight": 1,
"vectorWeight": 1
},
"indexed": {
"videos": 11,
"chunks": 339
},
"timings": {
"syncMs": 110,
"keywordMs": 3,
"vectorMs": 1,
"rerankMs": 0,
"totalMs": 115
},
"attempts": [
{
"id": "embed/cloudflare/@cf/baai/bge-m3",
"stage": "embed",
"outcome": "error",
"reason": "auth-401",
"detail": "cloudflare embeddings: HTTP 401 {\"result\":null,\"success\":false,\"errors\":[{\"code\":10000,\"message\":\"Authentication error\"}],\"messages\":[]}",
"ms": 63
}
],
"model": "embed/cloudflare/@cf/baai/bge-m3",
"vectorCoverage": {
"videos": 11,
"withVectors": 0
},
"vectorReason": "11 of 11 videos have no vectors yet; they are embedded on a later index or search."
}
}On a server with an embedding model configured, the same route also runs a vector search and merges the two lists; the response's meta says which sides ran.
Next
- Build a research collection: keep these videos together under one id, then pack, export and share them.
- Cited answers and briefs from the same videos.
- Many-video examples on one page.