From 4f31d0780a3c968e9341e369a10ba767f0b40aa9 Mon Sep 17 00:00:00 2001 From: Colby Lipsett Date: Fri, 2 Jan 2026 19:37:12 +0000 Subject: [PATCH] Delete downloader.py --- downloader.py | 56 --------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 downloader.py diff --git a/downloader.py b/downloader.py deleted file mode 100644 index f297cbd..0000000 --- a/downloader.py +++ /dev/null @@ -1,56 +0,0 @@ -import yt_dlp -import os -import re - -def clean_filename(title): - # Remove quotes and illegal characters - title = title.strip("'").strip('"') - return re.sub(r'[\\/*?:"<>|]', "", title) - -def download_mp3(url, quality='320'): - print(f"\nšŸ” Processing: {url}") - - # 1. Fetch Title First (Clean Name) - try: - with yt_dlp.YoutubeDL({'quiet':True}) as ydl: - info = ydl.extract_info(url, download=False) - if 'entries' in info: - title = '%(title)s' # Playlist default - else: - title = clean_filename(info['title']) - print(f"šŸ“ Renaming to: {title}") - except Exception as e: - print(f"āŒ Error fetching info: {e}") - return {"success": False, "error": "Invalid URL or video unavailable"} - - # 2. Download Options (adjustable quality) - ydl_opts = { - 'format': 'bestaudio/best', - 'postprocessors': [{ - 'key': 'FFmpegExtractAudio', - 'preferredcodec': 'mp3', - 'preferredquality': quality, - }], - 'outtmpl': f'music/{title}.%(ext)s', - 'quiet': False, - 'no_warnings': True, - } - - try: - with yt_dlp.YoutubeDL(ydl_opts) as ydl: - ydl.download([url]) - print("āœ… Success! (Hit Refresh in the App)") - return {"success": True, "title": title} - except Exception as e: - print(f"āŒ Error: {e}") - return {"success": False, "error": str(e)} - -if __name__ == "__main__": - if not os.path.exists("music"): - os.makedirs("music") - - print("--- TECHDJ DOWNLOADER (320kbps) ---") - while True: - url = input("\nšŸ”— URL (q to quit): ").strip() - if url.lower() == 'q': break - if url: download_mp3(url)