vbvbot9117 commited on
Commit
2ca7a17
·
verified ·
1 Parent(s): be2b0cf

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +104 -102
templates/index.html CHANGED
@@ -3,64 +3,73 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>YouTube Audio Downloader</title>
7
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
10
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
11
  </head>
12
- <body class="bg-gradient-to-br from-gray-50 to-gray-100 min-h-screen">
13
- <div class="container mx-auto px-4 py-12">
14
- <div class="max-w-2xl mx-auto">
15
- <!-- Header with animation -->
16
- <div class="text-center mb-12 animate-fade-in">
17
- <div class="flex items-center justify-center mb-4">
18
- <i class="fab fa-youtube text-red-500 text-5xl mr-3 animate-bounce"></i>
19
- <h1 class="text-4xl font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent">
20
- YouTube Audio Downloader
21
- </h1>
22
- </div>
23
- <p class="text-gray-600 text-lg">Convert and download your favorite YouTube videos as MP3</p>
24
  </div>
25
-
26
- <!-- Input Form with glassmorphism effect -->
27
- <div class="bg-white bg-opacity-80 backdrop-blur-lg rounded-xl shadow-lg p-8 mb-8 transform transition-all duration-300 hover:shadow-xl border border-gray-100">
28
- <div class="relative mb-6">
29
- <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
30
- <i class="fas fa-link text-blue-500"></i>
31
- </div>
32
- <input type="text" id="youtubeUrl"
33
- placeholder="Paste YouTube URL here"
34
- class="w-full pl-10 pr-4 py-4 border-2 border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all text-gray-700 bg-white bg-opacity-90">
 
 
 
 
 
35
  </div>
36
- <button onclick="getVideoInfo()"
37
- class="w-full bg-gradient-to-r from-blue-500 to-blue-600 text-white py-4 px-6 rounded-lg hover:from-blue-600 hover:to-blue-700 transition-all transform hover:scale-[1.02] flex items-center justify-center font-semibold">
38
- <i class="fas fa-search mr-2"></i>
39
- Get Video Info
40
- </button>
41
  </div>
42
 
43
- <!-- Video Info Section -->
44
- <div id="videoInfo" class="hidden animate-fade-in">
45
- <div class="bg-white bg-opacity-80 backdrop-blur-lg rounded-xl shadow-lg p-8 mb-8 transform transition-all duration-300 hover:shadow-xl border border-gray-100">
46
- <div id="videoDetails" class="mb-6">
47
- <div id="thumbnailContainer" class="mb-6 rounded-xl overflow-hidden shadow-md transform transition-all duration-300 hover:shadow-xl"></div>
48
- <h2 id="videoTitle" class="text-2xl font-semibold mb-4 text-gray-800"></h2>
49
- <div class="space-y-3">
50
- <p id="channelName" class="text-gray-600 flex items-center bg-gray-50 p-3 rounded-lg">
51
- <i class="fas fa-user-circle text-blue-500 mr-2"></i>
52
- <span></span>
53
- </p>
54
- <p id="duration" class="text-gray-600 flex items-center bg-gray-50 p-3 rounded-lg">
55
- <i class="fas fa-clock text-blue-500 mr-2"></i>
56
- <span></span>
57
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  </div>
59
  </div>
 
 
60
  <button onclick="downloadAudio()"
61
- class="w-full bg-gradient-to-r from-green-500 to-green-600 text-white py-4 px-6 rounded-lg hover:from-green-600 hover:to-green-700 transition-all transform hover:scale-[1.02] flex items-center justify-center font-semibold">
62
- <i class="fas fa-download mr-2"></i>
63
- Download Audio
64
  </button>
65
  </div>
66
  </div>
@@ -68,54 +77,48 @@
68
  </div>
69
 
70
  <script>
71
- // Add custom styles for animations
72
- const style = document.createElement('style');
73
- style.textContent = `
74
- @keyframes fade-in {
75
- from { opacity: 0; transform: translateY(20px); }
76
- to { opacity: 1; transform: translateY(0); }
77
- }
78
- .animate-fade-in {
79
- animation: fade-in 0.6s ease-out;
80
  }
81
- `;
82
- document.head.appendChild(style);
83
-
84
- function showLoading() {
85
- Swal.fire({
86
- title: 'Processing...',
87
- html: 'Please wait while we fetch the video information',
88
- timerProgressBar: true,
 
 
89
  showConfirmButton: false,
90
  allowOutsideClick: false,
91
- didOpen: () => {
92
- Swal.showLoading();
 
93
  }
94
  });
95
  }
96
 
97
  function showSuccess(message) {
98
- Swal.fire({
99
  icon: 'success',
100
- title: 'Success!',
101
- text: message,
102
- showConfirmButton: false,
103
- timer: 2000,
104
- position: 'top-end',
105
- toast: true,
106
  background: '#F0FDF4',
107
  iconColor: '#22C55E'
108
  });
109
  }
110
 
111
  function showError(message) {
112
- Swal.fire({
113
  icon: 'error',
114
- title: 'Oops...',
115
- text: message,
116
- showConfirmButton: true,
117
- position: 'top-end',
118
- toast: true,
119
  background: '#FEF2F2',
120
  iconColor: '#EF4444'
121
  });
@@ -134,7 +137,7 @@
134
  return;
135
  }
136
 
137
- showLoading();
138
  $('#videoInfo').addClass('hidden');
139
 
140
  $.ajax({
@@ -145,14 +148,14 @@
145
  success: function(response) {
146
  $('#thumbnailContainer').html(`
147
  <img src="${response.thumbnail}" alt="Video thumbnail"
148
- class="w-full rounded-lg transform transition-all duration-300 hover:scale-[1.02]">
149
  `);
150
  $('#videoTitle').text(response.title);
151
- $('#channelName span').text(`Channel: ${response.channel}`);
152
- $('#duration span').text(`Duration: ${formatDuration(response.duration)}`);
153
  $('#videoInfo').removeClass('hidden');
154
  Swal.close();
155
- showSuccess('Video information retrieved successfully');
156
  },
157
  error: function(xhr) {
158
  Swal.close();
@@ -168,16 +171,7 @@
168
  return;
169
  }
170
 
171
- Swal.fire({
172
- title: 'Starting Download',
173
- html: 'Preparing your audio file...',
174
- timerProgressBar: true,
175
- showConfirmButton: false,
176
- allowOutsideClick: false,
177
- didOpen: () => {
178
- Swal.showLoading();
179
- }
180
- });
181
 
182
  $.ajax({
183
  url: '/download',
@@ -198,23 +192,31 @@
198
  a.click();
199
  window.URL.revokeObjectURL(downloadUrl);
200
  Swal.close();
201
- showSuccess('Download started successfully');
202
  },
203
  error: function(xhr) {
204
  Swal.close();
205
- showError('Failed to download audio');
206
  }
207
  });
208
  }
209
 
210
- // Add nice entrance animation when page loads
211
- document.addEventListener('DOMContentLoaded', function() {
212
- document.body.style.opacity = '0';
213
- setTimeout(() => {
214
- document.body.style.transition = 'opacity 0.5s ease-in';
215
- document.body.style.opacity = '1';
216
- }, 100);
 
 
217
  });
 
 
 
 
 
218
  </script>
 
219
  </body>
220
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>YT Audio Downloader</title>
7
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
10
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
11
  </head>
12
+ <body class="bg-[#fafafa] dark:bg-gray-900 min-h-screen flex items-center justify-center p-4">
13
+ <div class="w-full max-w-xl mx-auto">
14
+ <!-- Ultra Modern Header -->
15
+ <div class="text-center mb-10 space-y-3">
16
+ <div class="inline-flex items-center justify-center p-2 rounded-full bg-red-50 dark:bg-red-900/20 mb-4">
17
+ <i class="fab fa-youtube text-red-500 text-3xl"></i>
 
 
 
 
 
 
18
  </div>
19
+ <h1 class="text-3xl font-bold bg-gradient-to-r from-gray-900 to-gray-700 dark:from-white dark:to-gray-300 bg-clip-text text-transparent">
20
+ YouTube Audio Downloader
21
+ </h1>
22
+ <p class="text-gray-500 dark:text-gray-400 text-sm">Simple • Fast • High Quality</p>
23
+ </div>
24
+
25
+ <!-- Main Card -->
26
+ <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg shadow-black/5 p-6 mb-6">
27
+ <!-- Search Input -->
28
+ <div class="relative mb-6 group">
29
+ <input type="text" id="youtubeUrl"
30
+ placeholder="Paste YouTube URL here"
31
+ class="w-full pl-12 pr-4 py-4 bg-gray-50 dark:bg-gray-900/50 border-0 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500/50 transition-all duration-300 text-gray-700 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-500">
32
+ <div class="absolute inset-y-0 left-4 flex items-center pointer-events-none transition-transform group-focus-within:scale-110">
33
+ <i class="fas fa-link text-gray-400 group-focus-within:text-blue-500 transition-colors"></i>
34
  </div>
 
 
 
 
 
35
  </div>
36
 
37
+ <!-- Search Button -->
38
+ <button onclick="getVideoInfo()"
39
+ class="w-full bg-blue-500 hover:bg-blue-600 active:bg-blue-700 text-white py-4 px-6 rounded-xl transition-all duration-300 flex items-center justify-center space-x-2 font-medium focus:outline-none focus:ring-2 focus:ring-blue-500/50 focus:ring-offset-2 dark:ring-offset-gray-800">
40
+ <i class="fas fa-search text-sm"></i>
41
+ <span>Get Video Info</span>
42
+ </button>
43
+ </div>
44
+
45
+ <!-- Video Info Card -->
46
+ <div id="videoInfo" class="hidden animate-fade-in">
47
+ <div class="bg-white dark:bg-gray-800 rounded-2xl shadow-lg shadow-black/5 overflow-hidden mb-6">
48
+ <!-- Thumbnail Container with Gradient Overlay -->
49
+ <div id="thumbnailContainer" class="relative">
50
+ <div class="absolute inset-0 bg-gradient-to-t from-black/50 to-transparent z-10"></div>
51
+ </div>
52
+
53
+ <!-- Video Details -->
54
+ <div class="p-6 space-y-4">
55
+ <h2 id="videoTitle" class="text-xl font-semibold text-gray-800 dark:text-white line-clamp-2"></h2>
56
+
57
+ <div class="space-y-2">
58
+ <div id="channelName" class="flex items-center text-sm text-gray-500 dark:text-gray-400">
59
+ <i class="fas fa-user-circle mr-2 text-blue-500"></i>
60
+ <span></span>
61
+ </div>
62
+ <div id="duration" class="flex items-center text-sm text-gray-500 dark:text-gray-400">
63
+ <i class="fas fa-clock mr-2 text-blue-500"></i>
64
+ <span></span>
65
  </div>
66
  </div>
67
+
68
+ <!-- Download Button -->
69
  <button onclick="downloadAudio()"
70
+ class="w-full bg-green-500 hover:bg-green-600 active:bg-green-700 text-white py-4 px-6 rounded-xl transition-all duration-300 flex items-center justify-center space-x-2 font-medium focus:outline-none focus:ring-2 focus:ring-green-500/50 focus:ring-offset-2 dark:ring-offset-gray-800 mt-4">
71
+ <i class="fas fa-download text-sm"></i>
72
+ <span>Download MP3</span>
73
  </button>
74
  </div>
75
  </div>
 
77
  </div>
78
 
79
  <script>
80
+ const Toast = Swal.mixin({
81
+ toast: true,
82
+ position: 'top-end',
83
+ showConfirmButton: false,
84
+ timer: 3000,
85
+ timerProgressBar: true,
86
+ didOpen: (toast) => {
87
+ toast.addEventListener('mouseenter', Swal.stopTimer)
88
+ toast.addEventListener('mouseleave', Swal.resumeTimer)
89
  }
90
+ });
91
+
92
+ function showLoading(message) {
93
+ return Swal.fire({
94
+ html: `
95
+ <div class="space-y-3">
96
+ <div class="w-16 h-16 mx-auto border-4 border-gray-200 border-t-blue-500 rounded-full animate-spin"></div>
97
+ <div class="text-gray-600 text-sm">${message}</div>
98
+ </div>
99
+ `,
100
  showConfirmButton: false,
101
  allowOutsideClick: false,
102
+ background: '#ffffff',
103
+ customClass: {
104
+ popup: 'rounded-2xl'
105
  }
106
  });
107
  }
108
 
109
  function showSuccess(message) {
110
+ Toast.fire({
111
  icon: 'success',
112
+ title: message,
 
 
 
 
 
113
  background: '#F0FDF4',
114
  iconColor: '#22C55E'
115
  });
116
  }
117
 
118
  function showError(message) {
119
+ Toast.fire({
120
  icon: 'error',
121
+ title: message,
 
 
 
 
122
  background: '#FEF2F2',
123
  iconColor: '#EF4444'
124
  });
 
137
  return;
138
  }
139
 
140
+ showLoading('Fetching video information...');
141
  $('#videoInfo').addClass('hidden');
142
 
143
  $.ajax({
 
148
  success: function(response) {
149
  $('#thumbnailContainer').html(`
150
  <img src="${response.thumbnail}" alt="Video thumbnail"
151
+ class="w-full object-cover transition-transform duration-300 hover:scale-105">
152
  `);
153
  $('#videoTitle').text(response.title);
154
+ $('#channelName span').text(response.channel);
155
+ $('#duration span').text(formatDuration(response.duration));
156
  $('#videoInfo').removeClass('hidden');
157
  Swal.close();
158
+ showSuccess('Video information retrieved');
159
  },
160
  error: function(xhr) {
161
  Swal.close();
 
171
  return;
172
  }
173
 
174
+ showLoading('Preparing your download...');
 
 
 
 
 
 
 
 
 
175
 
176
  $.ajax({
177
  url: '/download',
 
192
  a.click();
193
  window.URL.revokeObjectURL(downloadUrl);
194
  Swal.close();
195
+ showSuccess('Download started');
196
  },
197
  error: function(xhr) {
198
  Swal.close();
199
+ showError('Download failed');
200
  }
201
  });
202
  }
203
 
204
+ // Smooth page load animation
205
+ document.addEventListener('DOMContentLoaded', () => {
206
+ requestAnimationFrame(() => {
207
+ document.body.style.opacity = '0';
208
+ requestAnimationFrame(() => {
209
+ document.body.style.transition = 'opacity 0.5s ease-in';
210
+ document.body.style.opacity = '1';
211
+ });
212
+ });
213
  });
214
+
215
+ // Check system dark mode preference
216
+ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
217
+ document.documentElement.classList.add('dark');
218
+ }
219
  </script>
220
+ </head>
221
  </body>
222
  </html>