From e03ebc8bd2542f8fe9d13822f0781197b8fc5e7c Mon Sep 17 00:00:00 2001 From: Jack Clifton Date: Thu, 1 Oct 2026 07:56:15 +0100 Subject: [PATCH] Initial upload --- readme.md | 6 +++++ requirements.txt | 1 + source.json | 37 ++++++++++++++++++++++++++ ytaml.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 readme.md create mode 100644 requirements.txt create mode 100644 source.json create mode 100644 ytaml.py 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/source.json b/source.json new file mode 100644 index 0000000..6f01ef1 --- /dev/null +++ b/source.json @@ -0,0 +1,37 @@ +{ + "yt-links": { + "Ashley Parker Angel - Soundtrack To Your Life": + "https://www.youtube.com/playlist?list=PLQfPGHG_fQxzgV5NaLicleVHBlRsmuRHl", + "Breaking Benjamin - Dear Agony": + "https://www.youtube.com/playlist?list=PLBJm3cmRcPkKWlc8LTm7IUZU6VXUgYkiI", + "Emphatic - Damage": + "https://www.youtube.com/playlist?list=PLLy1F0NPv5gr-17iJN9rTAsb1F83PZ4t_", + "Hinder - Extreme Behaviour": + "", + "Meat Loaf - Bat Out Of Hell": + "https://www.youtube.com/playlist?list=PL248ar1sMUaBcgwctosA7BA1Yhvh99f5k", + "Meat Loaf - Bat Out Of Hell 2: Back Into Hell": + "https://www.youtube.com/playlist?list=PLoOX0vxaBPHMlwcJ5yd7vks90e4SVHtm1", + "Meat Loaf - Bat Out Of Hell 3: The Monster Is Loose": + "https://www.youtube.com/playlist?list=PLSIs4voBRsYY10sj56mIQ3dcPzjs3bjbU", + "My Favourite Highway - How To Call A Bluff": + "https://www.youtube.com/playlist?list=PLe30UiAEzig7fllqBtLAP0t4AmgCS9Nqo", + "Queen - Greatest Hits 1": + "https://www.youtube.com/playlist?list=PLdt2ksunnK_jEH1R15gPX7cI0zDzND-64", + "Queen - Greatest Hits 2": + "https://www.youtube.com/playlist?list=PL8Lpw39GxwbO_21jid3o2w2KrpMTTvah0", + "Queen - Greatest Hits 3": + "https://www.youtube.com/playlist?list=OLAK5uy_lp36qjOssdaEciKNN70w2-U0kq_unb6Qw", + "Quietdrive - Deliverance": + "https://www.youtube.com/playlist?list=PLiPUPASPNOQ2CaII4rBiuLV-9BqoE1IZU", + "SICK PUPPIES - Connect": + "https://www.youtube.com/playlist?list=PLLy1F0NPv5gp7_IOGL9MDmYovA8hTN6WM", + "Submersed - Immortal Verses": + "https://www.youtube.com/playlist?list=PLXIiHUVyE2EXGuaHX4wSmXBOSdOjITMqM", + } +} + + + + +// 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")