| import yt_dlp
|
| import os
|
|
|
|
|
| save_dir = r"C:\Users\yang2\Desktop\rebuttal\len_ab\TCR\m30"
|
| os.makedirs(save_dir, exist_ok=True)
|
|
|
|
|
| videos = [
|
| ("https://www.youtube.com/watch?v=w0elkU-2UGc", "n1.mp4"),
|
| ("https://www.youtube.com/watch?v=8qCIM06j3CA", "n2.mp4"),
|
| ("https://www.youtube.com/watch?v=REFL-JM5aDY", "n3.mp4"),
|
| ]
|
|
|
|
|
| ydl_opts = {
|
| 'format': 'bestvideo[height<=720]',
|
| 'merge_output_format': 'mp4',
|
| 'postprocessors': [
|
| {
|
| 'key': 'FFmpegVideoRemuxer',
|
| 'preferedformat': 'mp4'
|
| }
|
| ],
|
| 'quiet': False,
|
| 'outtmpl': ''
|
| }
|
|
|
| for url, filename in videos:
|
| output_path = os.path.join(save_dir, filename)
|
| ydl_opts['outtmpl'] = output_path
|
| print(f"Downloading {url} as {output_path} (video-only 720p)...")
|
| with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| ydl.download([url])
|
|
|
| print("✅ All videos downloaded to target folder in 720p (video-only).")
|
|
|