Skip to content

Commit 472339d

Browse files
committed
[Fixed Code scanning / CodeQL] Uncontrolled command line Critical
1 parent 8d8dbf9 commit 472339d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

backend/server.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,18 +442,9 @@ def get_transcript():
442442
if not video_id:
443443
return jsonify({"error": "No video ID provided"}), 400
444444

445-
video_url = f"https://www.youtube.com/watch?v={video_id}"
446-
command = [
447-
"yt-dlp",
448-
"--write-auto-sub",
449-
"--sub-lang", "en",
450-
"--skip-download",
451-
"--sub-format", "vtt",
452-
"-o", "subtitles/%(title)s [%(id)s].%(ext)s",
453-
video_url
454-
]
455-
456-
subprocess.run(command, capture_output=True, text=True)
445+
subprocess.run(["yt-dlp", "--write-auto-sub", "--sub-lang", "en", "--skip-download",
446+
"--sub-format", "vtt", "-o", f"subtitles/{video_id}.vtt", f"https://www.youtube.com/watch?v={video_id}"],
447+
check=True, capture_output=True, text=True)
457448

458449
# Find the latest .vtt file in the "subtitles" folder
459450
subtitle_files = glob.glob("subtitles/*.vtt")

0 commit comments

Comments
 (0)