ask-extract-youtube

Extract YouTube transcripts over HTTP with language selection, proxies, and formatters.

74|11|Updated Jul 4, 2024
One-click install
npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-extract-youtube-opensourceagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ask-extract-youtube
Source: https://github.com/OpenSourceAGI/qwksearch-research-agent/tree/main/skills/ask-extract-youtube
Command: npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-extract-youtube-opensourceagi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Fetching YouTube captions programmatically often fails in production: datacenter IPs get blocked, language selection returns the wrong track, and output formats vary across consumers. This Skill guides you through the extract-youtube package, a browserless transcript extractor that runs on serverless and edge platforms without an API key. ## Core Features & Use Cases - Transcript Fetching & Language Control: Use YouTubeTranscriptApi with ordered language preferences, manual-vs-auto track selection, and machine translation between tracks. - Proxy & Error Handling: Configure Webshare or generic HTTP proxies to bypass IP blocks, and diagnose typed errors like RequestBlocked, TranscriptsDisabled, NoTranscriptFound, and PoTokenRequired. - Output Formats & Tooling: Render transcripts as JSON, text, SRT, WebVTT, or article HTML, compute reading-speed encodings, embed the React modal, or run the CLI for one-off extractions. - Use Case: A serverless function needs German subtitles for a video URL. Extract the video id with extractVideoId, call fetchTranscript with languages ["de", "en"], and format the result as SRT — falling back to a Webshare proxy if YouTube blocks the datacenter IP. ## Quick Start Ask the assistant to fetch the English transcript for a given YouTube URL using extract-youtube and format it as SRT, configuring a Webshare proxy if the request gets blocked.

Frequently Asked Questions about ask-extract-youtube

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch a YouTube transcript in JavaScript without an API key?

Use the extract-youtube package: create a YouTubeTranscriptApi instance and call fetchTranscript with a video id and language list. It fetches caption tracks over plain HTTP, so it runs on serverless and edge platforms without a browser or API key.

How to fix RequestBlocked or IpBlocked errors when fetching YouTube transcripts?

These errors mean YouTube blocked your IP, which is common for datacenter ranges. Configure a WebshareProxyConfig with your credentials or a GenericProxyConfig with HTTP/HTTPS proxy URLs when constructing YouTubeTranscriptApi, or pass --proxy to the CLI.

Why does fetchTranscript throw InvalidVideoId on a valid YouTube URL?

fetchTranscript accepts only the bare 11-character video id, not a URL. Run the URL through the extractVideoId helper first, which handles any YouTube URL form, then pass the result to fetchTranscript.

Does extract-youtube support languages other than English?

Yes. Pass an ordered languages array like ["de", "en"] to fetchTranscript; it prefers manually created tracks over auto-generated ones. You can also call translate on a Transcript to get a machine translation into a supported target language.

What output formats can YouTube transcripts be converted to?

The package includes JSON, Text, PrettyPrint, Article, SRT, and WebVTT formatters, loadable by name via FormatterLoader. The CLI exposes the same choices through the -f flag, plus a speeds format for reading-speed encoding.

Can I use extract-youtube in a React application?

Yes, import YouTubeTranscriptModal from the extract-youtube/react subpath, which requires react, react-dom, and lucide-react as peers. Import from that subpath rather than the root entry to avoid pulling Node-specific code into the browser bundle.