I wrote this with help from an AI assistant (Claude), and the code was built with it too. I reviewed and tested everything before publishing.
YouTube is full of good football coaching: session walkthroughs, position-specific technique, match analysis. It is also slow to learn from. A 15-minute video might hold three useful cues and one drill, and finding them again a week later means scrubbing through the timeline.
This tutorial walks through a small open-source CLI, football-video-notes, that takes a YouTube URL and writes structured training notes: a five-line summary, coaching cues split into technique, tactical and mental, the drills described (setup and steps), a list of claims worth checking, and timestamps that link back to the video. It uses Supadata's JavaScript SDK for the transcript and the Anthropic SDK for the notes.
What you need
- Node.js 20.16 or newer
- A Supadata API key (
SUPADATA_API_KEY). Sign up at supadata.ai (that's my referral link; the free tier is enough to try this) - An Anthropic API key (
ANTHROPIC_API_KEY), optional: the--no-llmmode works without one
git clone https://github.com/REYmane/football-video-notes.git cd football-video-notes npm install && npm link football-video-notes "https://www.youtube.com/watch?v=VIDEO_ID" --lang en --out notes.md Step 1: get the transcript
Supadata's SDK has one call for transcripts across platforms. For short videos it returns the transcript directly; for long ones it returns a job id to poll. The tool handles both:
const first = await client.transcript({ url: sourceUrl, ...(options.lang ? { lang: options.lang } : {}), }); const transcript = await resolveTranscript( client, first, options.pollIntervalMs ?? 2000, options.maxPolls ?? 90, ); resolveTranscript checks for a jobId and, if there is one, polls client.transcript.getJobStatus(jobId) until the status is completed or failed.
The transcript comes back as chunks with a text and an offset in milliseconds. Those become segments with an offset in seconds, which is what the timestamps are built from later:
return content .map((chunk) => ({ text: chunk.text.replace(/\s+/g, " ").trim(), offsetSec: Number.isFinite(chunk.offset) ? Math.max(0, chunk.offset / 1000) : null, })) .filter((segment) => segment.text.length > 0); Step 2: cache it
Transcripts don't change, and API calls cost credits, so each one is written to .cache/<videoId>.<lang>.json and read from there on the next run. The cache check is the first thing fetchTranscript does:
if (!options.refresh) { const cached = await readCache(file); if (cached) return cached; } The write goes to a temporary file first and is then renamed, so an interrupted run doesn't leave a half-written cache entry. A --refresh flag skips the cache when you really want a new fetch.
Step 3: turn it into notes with Claude
The transcript is sent to Claude (snippet lightly condensed) as timestamped lines, like [01:03] Now the drill., so the model can copy the marker for each point it extracts. The request uses structured outputs: a JSON schema in output_config.format, which means the reply always has the same shape and parsing is a plain JSON.parse.
const response = await client.beta.messages.create({ model, max_tokens: options.maxTokens ?? 16000, system: SYSTEM_PROMPT, messages: [ { role: "user", content: `${header}<transcript>\n${transcriptForPrompt(transcript)}\n</transcript>` }, ], output_config: { format: { type: "json_schema", schema: LLM_OUTPUT_SCHEMA } }, ...(FALLBACK_MODELS.has(model) ? { betas: ["server-side-fallback-2026-07-01"], fallbacks: "default" as const } : {}), }); The default model is claude-sonnet-5-5, and --model changes it. On models that support it, the request also turns on the API's server-side fallback, so a declined request is retried on another model instead of failing.
Most of the work is in the system prompt. The key rules:
- use only what the transcript says, with no added advice or drills;
- if the speaker says "like this", note that the detail is visual instead of guessing;
- list claims presented as fact (injury, physiology, statistics, "always/never" rules) as claims to verify, without citing sources and without judging whether they are true.
That last rule matters. A language model asked for "sources" will happily invent plausible-looking ones. This tool flags the claim and leaves the checking to you.
Step 4: no LLM key? Use keywords
--no-llm swaps the model for a simple extractor. It joins transcript chunks into sentences (or ~22-word windows, since auto-captions often have no punctuation), then scores each sentence against cue word lists:
export const CUE_WORDS = { technique: words(["first touch", "body shape", "half[- ]turn", "back foot", "scan(?:ning)?", /* ... */]), tactical: words(["press(?:ing)?", "transition", "overload", "between the lines", /* ... */]), mental: words(["confiden(?:ce|t)", "communicat(?:e|ion)", "mistakes?", "composure", /* ... */]), } as const; A drill is a sentence that names a drill or exercise, followed by setup sentences (grid, cones, players) and step sentences (first, then, next). The output is extractive, the video's own words, and the notes say so at the top. It is rough, but it works offline and is easy to tune.
The output
Notes come out as Markdown or as JSON (--format json); the JSON follows a typed VideoNotes interface. In Markdown, each cue starts with a timestamp link such as [00:29](https://www.youtube.com/watch?v=...&t=29s), so you can jump straight to the moment. The repo's README shows a full example, generated from an invented sample transcript.
Testing without the network
The tests never call a real API. The CLI test mocks the Supadata SDK module itself:
vi.mock("@supadata/js", () => ({ Supadata: class { transcript = Object.assign(transcriptMock, { getJobStatus: vi.fn() }); metadata = vi.fn(async () => ({ title: FIXTURE_TITLE })); }, })); One of the tests runs the CLI twice on the same video and checks that the SDK was called once, which is the cache doing its job.
Limitations worth knowing
- Transcripts only hold what is said. Body shape shown on screen, or a drill drawn on a tactics board, is invisible to this tool.
- Coaching videos are expert opinion. Use the "claims to verify" list as a reading list, and ask a qualified coach or physio about anything injury-related.
- Respect creators' rights and YouTube's terms. This is for personal study and planning sessions, not for republishing someone else's content.
Try it
The code is MIT-licensed and kept small: four source files and a test suite. Ideas for contributions are in the README: cue word lists for other languages, better drill detection, a printable session-plan format. Fork it and adapt it to whatever videos you learn from.
