Initial upload
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
YouTube Audio Music downLoader
|
||||||
|
|
||||||
|
|
||||||
|
$ python3 -m venv .venv
|
||||||
|
$ source .venv/bin/activate
|
||||||
|
$ pip install -r requirements.txt
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
yt-dlp
|
||||||
+37
@@ -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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
@@ -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")
|
||||||
Reference in New Issue
Block a user