commit 6be8655393b220481f945d7752f046caf9edfdc9 Author: Jack Clifton Date: Thu Oct 1 07:56:15 2026 +0100 Initial upload diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..63dff6b --- /dev/null +++ b/readme.md @@ -0,0 +1,6 @@ +YouTube Audio Music downLoader + + +$ python3 -m venv .venv +$ source .venv/bin/activate +$ pip install -r requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b1df116 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +yt-dlp diff --git a/ytaml.py b/ytaml.py new file mode 100644 index 0000000..3ad94aa --- /dev/null +++ b/ytaml.py @@ -0,0 +1,68 @@ +import os +import sys +import json +import yt_dlp + + +def download_playlist_for_cd(playlist_url: str, output_folder: str = "cd_audio"): + """Downloads YouTube audio directly into 44.1kHz 16-bit WAV files + + ideal for burning directly to Audio CDs without secondary re-encoding loss. + """ + if not os.path.exists(output_folder): + os.makedirs(output_folder) + + ydl_opts = { + # Grab best audio stream available + "format": "bestaudio/best", + # Prefix with track index (01, 02...) so CD track order matches playlist order + "outtmpl": os.path.join(output_folder, "%(playlist_index)s - %(title)s.%(ext)s"), + "postprocessors": [ + { + "key": "FFmpegExtractAudio", + "preferredcodec": "wav", # Lossless format native to CD Burning + } + ], + # Enforce Red Book CD Standard audio resampling (44.1 kHz) + "postprocessor_args": [ + "-ar", "44100", # Set sample rate to 44.1 kHz (CD Standard) + "-ac", "2", # Force 2 channels (Stereo) + ], + "ignoreerrors": True, + } + + print(f"Downloading audio optimized for CD burning: {playlist_url}") + with yt_dlp.YoutubeDL(ydl_opts) as ydl: + ydl.download([playlist_url]) + + print("\nDownload complete! Import these .wav files directly into your CD burner.") + + + +def parse_file(filename): + + with open(filename, "r") as file: + data = json.load(file) + + links = data.get("yt-links", {}) + + return links + + + + +if __name__ == "__main__": + + if len(sys.argv) == 1: + url = input("Enter YouTube playlist URL: ").strip() + if url: + download_playlist_for_cd(url) + + else: + data = parse_file(" ".join(sys.argv[1:])) + for album, link in data.items(): + if link: + print(f"Album: {album}") + print(f"Link: {link}\n") + else: + print(f"Album: {album}\n")