From f6b7837f79b0b1a75bb3fea4fe7892660d637a04 Mon Sep 17 00:00:00 2001 From: Dani Tsvetkov Date: Mon, 17 Jun 2024 12:15:26 +0200 Subject: [PATCH] update yt-dlp --- main.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 699510f..46853c0 100644 --- a/main.py +++ b/main.py @@ -5,9 +5,9 @@ from common import run_os_cmd from compare import linear_compare # TODO: AMMEND THESE FOR NOW - should become cmdline params / text file -FINAL_TITLE = "plastic" -DE_VIDEO = "https://www.youtube.com/watch?v=mhmpeIyG0uM" -EN_VIDEO = "https://www.youtube.com/watch?v=RS7IzU2VJIQ" +FINAL_TITLE = "toki_nanpa" +DE_VIDEO = "https://www.youtube.com/watch?v=AgkDx8dIAio" +EN_VIDEO = "https://www.youtube.com/watch?v=_awfcwuJhpk" DE_SLOW_DOWN_COEF = 0.75 # slows down DE video the second time around # TODO: ASSUMPTION that if fix.txt exists it has been fixed already. @@ -116,14 +116,16 @@ def download_vids_and_subs(): run_os_cmd("rm en.mp4 de.mp4 subs.en.vtt subs.de.vtt") run_os_cmd("mkdir -p logs") run_os_cmd("mkdir -p tmp") - run_os_cmd("""youtube-dl -f worst --output="de.%(ext)s" {}""".format(DE_VIDEO)) - run_os_cmd("""youtube-dl -f worst --output="en.%(ext)s" {}""".format(EN_VIDEO)) + run_os_cmd("""/usr/bin/yt-dlp -f 'wv*[ext=mp4][height>=480]+ba[ext=m4a]/b[ext=mp4] / wv*+ba/b' --output="de.mp4" "{}" """.format(DE_VIDEO)) + run_os_cmd("""/usr/bin/yt-dlp -f 'wv*[ext=mp4][height>=480]+ba[ext=m4a]/b[ext=mp4] / wv*+ba/b' --output="en.mp4" "{}" """.format(EN_VIDEO)) run_os_cmd( - """youtube-dl --output="subs.%(ext)s" --write-sub --sub-format vtt --sub-lang de --skip-download {}""".format( + """/usr/bin/yt-dlp --output="subs.de.vtt" --write-sub --sub-format vtt --sub-lang tok --skip-download "{}" """.format( DE_VIDEO)) run_os_cmd( - """youtube-dl --output="subs.%(ext)s" --write-sub --sub-format vtt --sub-lang en --skip-download {}""".format( + """/usr/bin/yt-dlp --output="subs.en.vtt" --write-sub --sub-format vtt --sub-lang en --skip-download "{}" """.format( EN_VIDEO)) + run_os_cmd("""mv subs.de.vtt.tok.vtt subs.de.vtt""") + run_os_cmd("""mv subs.en.vtt.en.vtt subs.en.vtt""") def get_delta_at_time(t, syncs):