Vimeo to Podcast¶
Download vtt file fromo Vimeo¶
Translate to JP¶
https://translatesubtitles.co/
1 00:00:06.420 –> 00:00:17.290 Fab Classes: Welcome to the Fab Academy, and I’m gonna bring in a colleague to explain it.
2 00:00:19.110 –> 00:00:20.840 Fab Classes: Explain what it’s about.
3 00:00:23.910 –> 00:00:48.700 Fab Classes: Hi. Your site is empty. Yes, yes, I eat very healthy. I eat carrots, salad, onions. No, no, not healthy, empty, empty, I mean. You have no documents. Yes, nice monuments here in my country. No, no, no, I mean you need to catch up Whatsapp. Yes, I use Whatsapp and Instagram Tiktok, Twitter, Luciana, another one to the list.
4 00:01:00.141 –> 00:01:20.850 Fab Classes: Sorry, but I don’t understand.
5 00:01:20.850 –> 00:01:44.630 Fab Classes: I couldn’t make it right.
6 00:01:44.630 –> 00:02:04.360 Fab Classes: If you can find.
00:00:06.420 –> 00:00:17.290 Fab クラス: Fab アカデミーへようこそ。同僚を招いて説明してもらいます。
00:00:19.110 –> 00:00:20.840 Fab Classes: それが何であるかを説明します。
00:00:23.910 –> 00:00:48.700 Fab Classes:こんにちは。あなたのサイトには何も書かれていませんね。ええ、ええ、私はとても健康的な食事をしています。ニンジン、サラダ、玉ねぎは食べています。いえ、いえ、健康的ではありません。何も書かれていません。つまり、書類がないんです。ええ、私の国には素敵なモニュメントがあります。いえ、いえ、いえ、WhatsAppを使いこなす必要があるということですね。はい、私はWhatsAppとInstagram、TikTok、Twitter、ルシアナ、リストにもう1つ追加しました。
00:01:00.141 –> 00:01:20.850 Fab Classes: 申し訳ありませんが、理解できません。
00:01:20.850 –> 00:01:44.630 Fab Classes: うまくできませんでした。
Extract dialogue¶
import re # Regular expression module / 正規表現モジュール
import sys # Command-line argument module / コマンドライン引数の取得に使用
def extract_text_without_speaker(file_path, output_path="output.txt"):
# Open the VTT file / VTTファイルを開く
with open(file_path, "r", encoding="utf-8") as f:
lines = f.readlines()
text_lines = []
for line in lines:
line = line.strip()
if not line:
continue # Skip empty lines / 空行をスキップ
if "-->" in line or line.lower().startswith("webvtt"):
continue # Skip timestamp or header lines / タイムコードやヘッダー行をスキップ
# Remove speaker names like "Fab Classes:" or "Fab クラス:"
# 「Fab Classes:」「Fab クラス:」のような話者名を削除
line = re.sub(r'^(Fab\s?(クラス|Classes)[::]\s?)', '', line)
text_lines.append(line)
# Save the extracted text to a file / 抽出したテキストをファイルに保存
with open(output_path, "w", encoding="utf-8") as f:
f.write("\n".join(text_lines))
# --- How to run from command line / コマンドラインからの実行方法 ---
if __name__ == "__main__":
# Check if input file was provided / 入力ファイル名が指定されているか確認
if len(sys.argv) < 2:
print("Usage: python extract_vtt_dialogue_args.py input_file.vtt [output_file.txt]")
print("使い方: python extract_vtt_dialogue_args.py 入力ファイル.vtt [出力ファイル.txt]")
sys.exit(1)
input_file = sys.argv[1] # First argument: input file / 最初の引数:入力ファイル名
output_file = sys.argv[2] if len(sys.argv) >= 3 else "output.txt" # Second optional argument / 2番目の引数(省略可)
extract_text_without_speaker(input_file, output_file)
print(f"✅ Done! Text saved as '{output_file}'") # 完了メッセージ
Usage¶
% cd go/to/the/folder
% tree
.
├── extract_vtt_dialogue_args.py
└── input.vtt
# 入力・出力ファイルを両方指定
% python extract_vtt_dialogue_args.py input.vtt result.txt
# 入力ファイルだけ指定(出力は output.txt)
% python extract_vtt_dialogue_args.py example.vtt
result.txt¶
Fab アカデミーへようこそ。同僚を招いて説明してもらいます。
それが何であるかを説明します。
こんにちは。あなたのサイトには何も書かれていませんね。ええ、ええ、私はとても健康的な食事をしています。ニンジン、サラダ、玉ねぎは食べています。いえ、いえ、健康的ではありません。何も書かれていません。つまり、書類がないんです。ええ、私の国には素敵なモニュメントがあります。いえ、いえ、いえ、WhatsAppを使いこなす必要があるということですね。はい、私はWhatsAppとInstagram、TikTok、Twitter、ルシアナ、リストにもう1つ追加しました。
申し訳ありませんが、理解できません。
うまくできませんでした。