SuperAPI AI Directory

my-fetch-youtube

General & other

View repository

Updated 10-15 21:38

About this skill

my-fetch-youtube

A skill that extracts subtitles from a YouTube video, corrects auto-caption errors via Web Search, and then provides a summary, insights, and a full translation.

Environment Note: In this environment, yt-dlp is run with the python -m yt_dlp command.

Subtitle Extraction and Cleanup

1. Subtitle Extraction Command

python -m yt_dlp --write-auto-sub --sub-lang "ko,en" --skip-download \
  --convert-subs vtt -o "%(title)s" "{URL}"
  • --write-auto-sub: Include auto-generated subtitles
  • --sub-lang "ko,en": Korean first, English second
  • --skip-download: Do not download the video file
  • --convert-subs vtt: Convert to VTT format

2. VTT → Plain Text Cleanup

From the extracted .vtt file, remove timestamps, tags, and numbers to produce plain text:

cat "파일명.vtt" \
  | sed -E 's/^[0-9]+$//' \
  | sed -E 's/[0-9]{2}:[0-9]{2}:[0-9]{2}.*//g' \
  | sed -E 's/<[^>]+>//g' \
  | tr -s '\n' \
  | grep -v '^$'

Each step:

  1. ^[0-9]+$ removal → delete line numbers
  2. HH:MM:SS... removal → delete timestamps
  3. <태그> removal → delete web-format markup
  4. tr -s '\n' → collapse consecutive blank lines
  5. grep -v '^$' → remove blank lines

3. Subtitle Language Priority

한국어 수동 자막 (ko)
  → 없으면 영어 수동 자막 (en)
  → 없으면 한국어 자동 자막 (ko-auto)
  → 없으면 영어 자동 자막 (en-auto)

4. When There Are No Subtitles

If no subtitles are available:

"This video has no subtitles. Please choose another video that has subtitles."

Metadata Extraction

Command

python -m yt_dlp --dump-json --no-download "{URL}"

Output the entire JSON. Retrieve only metadata without downloading the video.

Key Fields to Extract

Field Description Usage
title Video title Source of keywords for Web Search correction
description Video description Source for extracting proper nouns/technical terms
channel Channel name Source attribution
duration Duration (seconds) If 10 minutes or longer, judge whether to use a Task Agent
chapters Chapter list (if any) Used to divide sections when translating

How to Use

  1. title + descriptionExtract proper nouns and technical terms from → use for Step 4 Web Search correction
  2. durationIf this exceeds 600 seconds (10 minutes) → recommend using a Task Agent
  3. chaptersIf present → output the translation divided by chapter

Web Search Correction

YouTube auto-captions use AI speech recognition, so they may misrecognize proper nouns and technical terms. Search the web using keywords from the title and description to verify the correct spellings and correct the subtitles.

Step 1: Keyword Extraction (5-10)

title과 descriptionExtract the following types of words from :

  • People's names (presenters, interviewees, etc.)
  • Company names, product names, service names
  • Technical terms and abbreviations
  • Proper nouns (project names, paper titles, etc.)

Step 2: Run WebSearch in Parallel

Search the web simultaneously using the extracted keywords:

검색 쿼리 예시:
- "{사람 이름} {회사명}"
- "{전문 용어} 정확한 표기"
- "{약어} full name"
- "{제품명} official"

Step 3: Subtitle Correction + Log the Details

Based on the search results, correct errors in the subtitle text and record the correction details.

Before/after correction examples:

Before correction (automatic subtitle errors) After correction (correct notation)
Cloud Claude
Anthropic Anthropic
GPT four GPT-4
OpenAI OpenAI
rag RAG (Retrieval-Augmented Generation)
lang chain LangChain

Correction details output format:

[Web Search 보정 내역]
- "Cloud" → "Claude" (검색 확인: Anthropic Claude AI)
- "앤트로피" → "Anthropic" (검색 확인: anthropic.com)
총 N개 항목 보정

Translation pipeline

After subtitle extraction + Web Search correction is complete, provide in the following 3-step order.

Long video (10 minutes or more, duration > 600 seconds): Since the subtitle text is extensive, process with a Task Agent.

Task(description="YouTube 번역", prompt="자막 전체를 읽고 요약-인사이트-아티클로 번역하라")

Step 1: Summary (3-5 sentences)

  • Summarize the entire video content in Korean
  • Include channel name, video title, and length
  • Condense around the key topics and conclusions

Step 2: Insights (3)

  • Key message: What this video really wants to say
  • Implications: Meaning in the industry/trends, why this content now
  • Application: What it means to me (the viewer), how I can use it

Step 3: Full translated article

  • Translate the entire subtitle into an easy-to-read article format(not transcription X, but natural sentences)
  • If there are chapters, separate sections by chapter (## 챕터명)
  • Use correct terminology corrected via Web Search
  • For technical terms, include the original text (e.g., "Retrieval-Augmented Generation(RAG)")