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:
parent
b0b79515ca
commit
ba61434798
1 changed files with 246 additions and 5 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue