feat: extract_text.py – YouTube-URL → Textdatei in einem Schritt

- Kombiniert yt_untertitel.py und vtt2txt.py; die VTT bleibt temporär
- Standardsprache ist die des Original-Audios (original_language())
- -o Ausgabedatei, Standard output.txt
- Tests ohne Netz, README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-10-10 19:51:32 +02:00
commit ba61434798

View file

@ -35,6 +35,17 @@ def choose_track(info, lang):
return None
def original_language(info):
"""Language of the video's audio, or None if yt-dlp does not know it.
YouTube marks the automatic captions in the spoken language with "-orig".
"""
for name in info.get("automatic_captions") or {}:
if name.endswith("-orig"):
return name.removesuffix("-orig")
return info.get("language")
def available_tracks(info):
manual = sorted((info.get("subtitles") or {}).keys())
original = sorted(