Spaces:
Running
Running
man soll auch musik von yt music downloaden können - Initial Deployment
Browse files- README.md +7 -5
- index.html +365 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: yt-downloader
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,365 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>YTDownloader - Free YouTube Video Downloader</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<script>
|
| 10 |
+
tailwind.config = {
|
| 11 |
+
darkMode: 'class',
|
| 12 |
+
theme: {
|
| 13 |
+
extend: {
|
| 14 |
+
animation: {
|
| 15 |
+
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
| 16 |
+
'bounce-slow': 'bounce 2s infinite'
|
| 17 |
+
},
|
| 18 |
+
colors: {
|
| 19 |
+
primary: {
|
| 20 |
+
light: '#FF0000',
|
| 21 |
+
dark: '#FF3333'
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
</script>
|
| 28 |
+
<style>
|
| 29 |
+
.gradient-bg {
|
| 30 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 31 |
+
}
|
| 32 |
+
.dark .gradient-bg {
|
| 33 |
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
| 34 |
+
}
|
| 35 |
+
.video-card {
|
| 36 |
+
transition: all 0.3s ease;
|
| 37 |
+
}
|
| 38 |
+
.video-card:hover {
|
| 39 |
+
transform: translateY(-5px);
|
| 40 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
| 41 |
+
}
|
| 42 |
+
.dark .video-card:hover {
|
| 43 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
| 44 |
+
}
|
| 45 |
+
.loader {
|
| 46 |
+
border-top-color: #FF0000;
|
| 47 |
+
-webkit-animation: spinner 1.5s linear infinite;
|
| 48 |
+
animation: spinner 1.5s linear infinite;
|
| 49 |
+
}
|
| 50 |
+
@-webkit-keyframes spinner {
|
| 51 |
+
0% { -webkit-transform: rotate(0deg); }
|
| 52 |
+
100% { -webkit-transform: rotate(360deg); }
|
| 53 |
+
}
|
| 54 |
+
@keyframes spinner {
|
| 55 |
+
0% { transform: rotate(0deg); }
|
| 56 |
+
100% { transform: rotate(360deg); }
|
| 57 |
+
}
|
| 58 |
+
</style>
|
| 59 |
+
</head>
|
| 60 |
+
<body class="gradient-bg min-h-screen transition-colors duration-300">
|
| 61 |
+
<div class="container mx-auto px-4 py-8">
|
| 62 |
+
<!-- Header -->
|
| 63 |
+
<header class="flex justify-between items-center mb-10">
|
| 64 |
+
<div class="flex items-center">
|
| 65 |
+
<i class="fab fa-youtube text-4xl mr-3 text-primary-light dark:text-primary-dark"></i>
|
| 66 |
+
<h1 class="text-3xl font-bold text-gray-800 dark:text-white">
|
| 67 |
+
<span class="text-primary-light dark:text-primary-dark">YT</span>Downloader
|
| 68 |
+
</h1>
|
| 69 |
+
</div>
|
| 70 |
+
<button id="themeToggle" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200">
|
| 71 |
+
<i class="fas fa-moon dark:hidden"></i>
|
| 72 |
+
<i class="fas fa-sun hidden dark:block"></i>
|
| 73 |
+
</button>
|
| 74 |
+
</header>
|
| 75 |
+
|
| 76 |
+
<!-- Main Content -->
|
| 77 |
+
<main>
|
| 78 |
+
<div class="max-w-3xl mx-auto">
|
| 79 |
+
<!-- Search Box -->
|
| 80 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6 mb-8 transition-all duration-300 hover:shadow-xl">
|
| 81 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-white">Download YouTube Videos</h2>
|
| 82 |
+
<div class="flex flex-col md:flex-row gap-4">
|
| 83 |
+
<input
|
| 84 |
+
type="text"
|
| 85 |
+
id="videoUrl"
|
| 86 |
+
placeholder="Paste YouTube or YouTube Music URL here..."
|
| 87 |
+
class="flex-grow px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 focus:outline-none focus:ring-2 focus:ring-primary-light dark:focus:ring-primary-dark bg-white dark:bg-gray-700 text-gray-800 dark:text-white"
|
| 88 |
+
>
|
| 89 |
+
<button
|
| 90 |
+
id="downloadBtn"
|
| 91 |
+
class="px-6 py-3 bg-primary-light dark:bg-primary-dark text-white rounded-lg font-medium hover:opacity-90 transition-opacity flex items-center justify-center"
|
| 92 |
+
>
|
| 93 |
+
<i class="fas fa-download mr-2"></i> Download
|
| 94 |
+
</button>
|
| 95 |
+
</div>
|
| 96 |
+
<p class="text-sm text-gray-500 dark:text-gray-400 mt-3">Supports YouTube & YouTube Music - All formats: MP4, WEBM, 3GP, MP3 and more</p>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<!-- How It Works -->
|
| 100 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6 mb-8">
|
| 101 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-white">How to Download</h2>
|
| 102 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 103 |
+
<div class="flex flex-col items-center text-center">
|
| 104 |
+
<div class="w-16 h-16 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center mb-3">
|
| 105 |
+
<i class="fas fa-link text-blue-600 dark:text-blue-300 text-2xl"></i>
|
| 106 |
+
</div>
|
| 107 |
+
<h3 class="font-medium text-gray-800 dark:text-white mb-1">1. Paste URL</h3>
|
| 108 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">Copy and paste the YouTube video URL</p>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="flex flex-col items-center text-center">
|
| 111 |
+
<div class="w-16 h-16 bg-purple-100 dark:bg-purple-900 rounded-full flex items-center justify-center mb-3">
|
| 112 |
+
<i class="fas fa-cog text-purple-600 dark:text-purple-300 text-2xl"></i>
|
| 113 |
+
</div>
|
| 114 |
+
<h3 class="font-medium text-gray-800 dark:text-white mb-1">2. Process</h3>
|
| 115 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">Our system will analyze the video</p>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="flex flex-col items-center text-center">
|
| 118 |
+
<div class="w-16 h-16 bg-green-100 dark:bg-green-900 rounded-full flex items-center justify-center mb-3">
|
| 119 |
+
<i class="fas fa-download text-green-600 dark:text-green-300 text-2xl"></i>
|
| 120 |
+
</div>
|
| 121 |
+
<h3 class="font-medium text-gray-800 dark:text-white mb-1">3. Download</h3>
|
| 122 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">Choose format and download</p>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
|
| 127 |
+
<!-- Results Section (Initially Hidden) -->
|
| 128 |
+
<div id="resultsSection" class="hidden bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6 mb-8">
|
| 129 |
+
<div class="flex justify-between items-center mb-4">
|
| 130 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white">Download Options</h2>
|
| 131 |
+
<button id="newDownloadBtn" class="text-sm text-primary-light dark:text-primary-dark hover:underline">
|
| 132 |
+
<i class="fas fa-redo mr-1"></i> New Download
|
| 133 |
+
</button>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<!-- Video Info -->
|
| 137 |
+
<div id="videoInfo" class="flex flex-col md:flex-row gap-4 mb-6">
|
| 138 |
+
<div class="w-full md:w-1/3">
|
| 139 |
+
<div class="relative pb-[56.25%] bg-gray-200 dark:bg-gray-700 rounded-lg overflow-hidden">
|
| 140 |
+
<img id="videoThumbnail" src="" alt="Video thumbnail" class="absolute h-full w-full object-cover">
|
| 141 |
+
<div class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-30">
|
| 142 |
+
<i class="fab fa-youtube text-5xl text-white opacity-80"></i>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
<div class="w-full md:w-2/3">
|
| 147 |
+
<h3 id="videoTitle" class="text-lg font-medium text-gray-800 dark:text-white mb-2"></h3>
|
| 148 |
+
<p id="videoDuration" class="text-sm text-gray-600 dark:text-gray-400 mb-3"></p>
|
| 149 |
+
<div class="flex flex-wrap gap-2">
|
| 150 |
+
<span id="videoViews" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-xs text-gray-800 dark:text-gray-300"></span>
|
| 151 |
+
<span id="videoUploadDate" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-xs text-gray-800 dark:text-gray-300"></span>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
<!-- Loading State -->
|
| 157 |
+
<div id="loadingState" class="flex flex-col items-center justify-center py-8">
|
| 158 |
+
<div class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12 mb-4"></div>
|
| 159 |
+
<p class="text-gray-600 dark:text-gray-400">Processing video, please wait...</p>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<!-- Download Options -->
|
| 163 |
+
<div id="downloadOptions" class="hidden">
|
| 164 |
+
<div class="mb-4">
|
| 165 |
+
<div class="flex items-center mb-2">
|
| 166 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Video Formats</h3>
|
| 167 |
+
<span class="ml-2 px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-xs text-gray-800 dark:text-gray-300">MP4</span>
|
| 168 |
+
</div>
|
| 169 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 mb-4" id="videoFormats">
|
| 170 |
+
<!-- Dynamically populated -->
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<div>
|
| 175 |
+
<div class="flex items-center mb-2">
|
| 176 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Audio Only</h3>
|
| 177 |
+
<span class="ml-2 px-2 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-xs text-gray-800 dark:text-gray-300">MP3</span>
|
| 178 |
+
</div>
|
| 179 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-3" id="audioFormats">
|
| 180 |
+
<!-- Dynamically populated -->
|
| 181 |
+
</div>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
|
| 186 |
+
<!-- Features -->
|
| 187 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6">
|
| 188 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-white">Why Choose Us?</h2>
|
| 189 |
+
<div class="space-y-4">
|
| 190 |
+
<div class="flex items-start">
|
| 191 |
+
<div class="flex-shrink-0 mt-1">
|
| 192 |
+
<div class="w-8 h-8 bg-primary-light dark:bg-primary-dark rounded-full flex items-center justify-center">
|
| 193 |
+
<i class="fas fa-bolt text-white text-sm"></i>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
<div class="ml-3">
|
| 197 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Fast Downloads</h3>
|
| 198 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">Our servers provide high-speed downloads for all your videos.</p>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
<div class="flex items-start">
|
| 202 |
+
<div class="flex-shrink-0 mt-1">
|
| 203 |
+
<div class="w-8 h-8 bg-primary-light dark:bg-primary-dark rounded-full flex items-center justify-center">
|
| 204 |
+
<i class="fas fa-lock text-white text-sm"></i>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
<div class="ml-3">
|
| 208 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Secure & Private</h3>
|
| 209 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">We don't store your videos or track your downloads.</p>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
<div class="flex items-start">
|
| 213 |
+
<div class="flex-shrink-0 mt-1">
|
| 214 |
+
<div class="w-8 h-8 bg-primary-light dark:bg-primary-dark rounded-full flex items-center justify-center">
|
| 215 |
+
<i class="fas fa-mobile-alt text-white text-sm"></i>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
<div class="ml-3">
|
| 219 |
+
<h3 class="font-medium text-gray-800 dark:text-white">All Devices Supported</h3>
|
| 220 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm">Download videos compatible with any device or platform.</p>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
</main>
|
| 227 |
+
|
| 228 |
+
<!-- Footer -->
|
| 229 |
+
<footer class="mt-16 text-center text-gray-600 dark:text-gray-400 text-sm">
|
| 230 |
+
<p>© 2023 YTDownloader. All rights reserved.</p>
|
| 231 |
+
<p class="mt-1">This service is for educational purposes only.</p>
|
| 232 |
+
</footer>
|
| 233 |
+
</div>
|
| 234 |
+
|
| 235 |
+
<script>
|
| 236 |
+
// Theme toggle
|
| 237 |
+
const themeToggle = document.getElementById('themeToggle');
|
| 238 |
+
themeToggle.addEventListener('click', () => {
|
| 239 |
+
document.documentElement.classList.toggle('dark');
|
| 240 |
+
localStorage.setItem('darkMode', document.documentElement.classList.contains('dark'));
|
| 241 |
+
});
|
| 242 |
+
|
| 243 |
+
// Check for saved theme preference
|
| 244 |
+
if (localStorage.getItem('darkMode') === 'true') {
|
| 245 |
+
document.documentElement.classList.add('dark');
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Mock download functionality (in a real app, this would connect to a backend service)
|
| 249 |
+
const downloadBtn = document.getElementById('downloadBtn');
|
| 250 |
+
const videoUrl = document.getElementById('videoUrl');
|
| 251 |
+
const resultsSection = document.getElementById('resultsSection');
|
| 252 |
+
const loadingState = document.getElementById('loadingState');
|
| 253 |
+
const downloadOptions = document.getElementById('downloadOptions');
|
| 254 |
+
const newDownloadBtn = document.getElementById('newDownloadBtn');
|
| 255 |
+
const videoInfo = document.getElementById('videoInfo');
|
| 256 |
+
const videoTitle = document.getElementById('videoTitle');
|
| 257 |
+
const videoThumbnail = document.getElementById('videoThumbnail');
|
| 258 |
+
const videoDuration = document.getElementById('videoDuration');
|
| 259 |
+
const videoViews = document.getElementById('videoViews');
|
| 260 |
+
const videoUploadDate = document.getElementById('videoUploadDate');
|
| 261 |
+
const videoFormats = document.getElementById('videoFormats');
|
| 262 |
+
const audioFormats = document.getElementById('audioFormats');
|
| 263 |
+
|
| 264 |
+
downloadBtn.addEventListener('click', () => {
|
| 265 |
+
const url = videoUrl.value.trim();
|
| 266 |
+
|
| 267 |
+
// Basic URL validation
|
| 268 |
+
if (!url || (!url.includes('youtube.com') && !url.includes('youtu.be') && !url.includes('music.youtube.com'))) {
|
| 269 |
+
alert('Please enter a valid YouTube URL');
|
| 270 |
+
return;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
// Show loading state
|
| 274 |
+
resultsSection.classList.remove('hidden');
|
| 275 |
+
loadingState.classList.remove('hidden');
|
| 276 |
+
downloadOptions.classList.add('hidden');
|
| 277 |
+
videoInfo.classList.add('hidden');
|
| 278 |
+
|
| 279 |
+
// Simulate API call delay
|
| 280 |
+
setTimeout(() => {
|
| 281 |
+
// Mock data - in a real app, this would come from your backend
|
| 282 |
+
const videoData = {
|
| 283 |
+
title: "How to Build a YouTube Downloader",
|
| 284 |
+
thumbnail: "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
|
| 285 |
+
duration: "12:34",
|
| 286 |
+
views: "1.2M views",
|
| 287 |
+
uploadDate: "Uploaded 2 weeks ago",
|
| 288 |
+
formats: [
|
| 289 |
+
{ quality: "1080p", type: "MP4", size: "45.2 MB", url: "#" },
|
| 290 |
+
{ quality: "720p", type: "MP4", size: "28.7 MB", url: "#" },
|
| 291 |
+
{ quality: "480p", type: "MP4", size: "15.3 MB", url: "#" },
|
| 292 |
+
{ quality: "360p", type: "MP4", size: "9.8 MB", url: "#" },
|
| 293 |
+
{ quality: "144p", type: "MP4", size: "3.2 MB", url: "#" },
|
| 294 |
+
{ quality: "High", type: "MP3", size: "5.6 MB", url: "#" },
|
| 295 |
+
{ quality: "Medium", type: "MP3", size: "3.8 MB", url: "#" },
|
| 296 |
+
{ quality: "Low", type: "MP3", size: "2.1 MB", url: "#" }
|
| 297 |
+
]
|
| 298 |
+
};
|
| 299 |
+
|
| 300 |
+
// Populate video info
|
| 301 |
+
videoTitle.textContent = videoData.title;
|
| 302 |
+
videoThumbnail.src = videoData.thumbnail;
|
| 303 |
+
videoDuration.textContent = videoData.duration;
|
| 304 |
+
videoViews.textContent = videoData.views;
|
| 305 |
+
videoUploadDate.textContent = videoData.uploadDate;
|
| 306 |
+
|
| 307 |
+
// Populate video formats
|
| 308 |
+
videoFormats.innerHTML = '';
|
| 309 |
+
audioFormats.innerHTML = '';
|
| 310 |
+
|
| 311 |
+
videoData.formats.forEach(format => {
|
| 312 |
+
const formatElement = document.createElement('div');
|
| 313 |
+
formatElement.className = 'video-card bg-gray-50 dark:bg-gray-700 p-4 rounded-lg';
|
| 314 |
+
|
| 315 |
+
const isAudio = format.type === 'MP3';
|
| 316 |
+
const icon = isAudio ? 'fas fa-music' : 'fas fa-video';
|
| 317 |
+
const bgColor = isAudio ? 'bg-purple-100 dark:bg-purple-900' : 'bg-blue-100 dark:bg-blue-900';
|
| 318 |
+
const textColor = isAudio ? 'text-purple-600 dark:text-purple-300' : 'text-blue-600 dark:text-blue-300';
|
| 319 |
+
|
| 320 |
+
formatElement.innerHTML = `
|
| 321 |
+
<div class="flex items-center justify-between">
|
| 322 |
+
<div class="flex items-center">
|
| 323 |
+
<div class="w-10 h-10 ${bgColor} rounded-full flex items-center justify-center mr-3">
|
| 324 |
+
<i class="${icon} ${textColor}"></i>
|
| 325 |
+
</div>
|
| 326 |
+
<div>
|
| 327 |
+
<h4 class="font-medium text-gray-800 dark:text-white">${format.quality}</h4>
|
| 328 |
+
<p class="text-xs text-gray-600 dark:text-gray-400">${format.type} • ${format.size}</p>
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
<a href="${format.url}" class="px-3 py-1 bg-primary-light dark:bg-primary-dark text-white text-sm rounded hover:opacity-90 transition-opacity">
|
| 332 |
+
Download
|
| 333 |
+
</a>
|
| 334 |
+
</div>
|
| 335 |
+
`;
|
| 336 |
+
|
| 337 |
+
if (isAudio) {
|
| 338 |
+
audioFormats.appendChild(formatElement);
|
| 339 |
+
} else {
|
| 340 |
+
videoFormats.appendChild(formatElement);
|
| 341 |
+
}
|
| 342 |
+
});
|
| 343 |
+
|
| 344 |
+
// Hide loading, show results
|
| 345 |
+
loadingState.classList.add('hidden');
|
| 346 |
+
videoInfo.classList.remove('hidden');
|
| 347 |
+
downloadOptions.classList.remove('hidden');
|
| 348 |
+
}, 2000);
|
| 349 |
+
});
|
| 350 |
+
|
| 351 |
+
// New download button
|
| 352 |
+
newDownloadBtn.addEventListener('click', () => {
|
| 353 |
+
resultsSection.classList.add('hidden');
|
| 354 |
+
videoUrl.value = '';
|
| 355 |
+
});
|
| 356 |
+
|
| 357 |
+
// Example URLs for demo purposes
|
| 358 |
+
videoUrl.addEventListener('focus', () => {
|
| 359 |
+
if (!videoUrl.value) {
|
| 360 |
+
videoUrl.value = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
|
| 361 |
+
}
|
| 362 |
+
});
|
| 363 |
+
</script>
|
| 364 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=AgentP23/yt-downloader" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 365 |
+
</html>
|