undefined - Initial Deployment
Browse files- README.md +6 -4
- index.html +486 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: red
|
| 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: mp3-mp4
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: purple
|
| 5 |
colorTo: red
|
| 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,486 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>mp3_mp4 - 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 |
+
<style>
|
| 10 |
+
/* Custom animations */
|
| 11 |
+
@keyframes fadeIn {
|
| 12 |
+
from { opacity: 0; }
|
| 13 |
+
to { opacity: 1; }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
@keyframes slideUp {
|
| 17 |
+
from { transform: translateY(20px); opacity: 0; }
|
| 18 |
+
to { transform: translateY(0); opacity: 1; }
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.fade-in {
|
| 22 |
+
animation: fadeIn 0.5s ease-out forwards;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.slide-up {
|
| 26 |
+
animation: slideUp 0.4s ease-out forwards;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* Custom scrollbar */
|
| 30 |
+
::-webkit-scrollbar {
|
| 31 |
+
width: 6px;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
::-webkit-scrollbar-track {
|
| 35 |
+
background: rgba(0, 0, 0, 0.1);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
::-webkit-scrollbar-thumb {
|
| 39 |
+
background: #4f46e5;
|
| 40 |
+
border-radius: 3px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/* Dark mode toggle transition */
|
| 44 |
+
.dark-toggle {
|
| 45 |
+
transition: all 0.3s ease;
|
| 46 |
+
}
|
| 47 |
+
</style>
|
| 48 |
+
</head>
|
| 49 |
+
<body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-200 min-h-screen transition-colors duration-300">
|
| 50 |
+
<!-- App Container -->
|
| 51 |
+
<div class="max-w-md mx-auto min-h-screen flex flex-col overflow-hidden relative" id="app">
|
| 52 |
+
<!-- Welcome Screen -->
|
| 53 |
+
<div id="welcome-screen" class="flex flex-col items-center justify-center flex-1 p-6 fade-in">
|
| 54 |
+
<div class="text-center slide-up">
|
| 55 |
+
<div class="w-24 h-24 bg-indigo-500 rounded-2xl flex items-center justify-center mx-auto mb-6 shadow-lg">
|
| 56 |
+
<i class="fas fa-music text-white text-4xl"></i>
|
| 57 |
+
</div>
|
| 58 |
+
<h1 class="text-4xl font-bold text-indigo-600 dark:text-indigo-400 mb-2">mp3_mp4</h1>
|
| 59 |
+
<p class="text-lg text-gray-600 dark:text-gray-300 mb-8">Paste your link and download easily</p>
|
| 60 |
+
<button onclick="showMainScreen()" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-8 rounded-full shadow-md transition-all transform hover:scale-105">
|
| 61 |
+
Start
|
| 62 |
+
</button>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<!-- Main Screen -->
|
| 67 |
+
<div id="main-screen" class="flex-1 flex flex-col p-6 hidden">
|
| 68 |
+
<!-- Header -->
|
| 69 |
+
<div class="flex justify-between items-center mb-6">
|
| 70 |
+
<h2 class="text-2xl font-bold text-indigo-600 dark:text-indigo-400">Download Media</h2>
|
| 71 |
+
<div class="flex items-center space-x-4">
|
| 72 |
+
<button onclick="toggleDarkMode()" class="dark-toggle p-2 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600">
|
| 73 |
+
<i class="fas fa-moon dark:hidden"></i>
|
| 74 |
+
<i class="fas fa-sun hidden dark:block"></i>
|
| 75 |
+
</button>
|
| 76 |
+
<button onclick="showHistoryScreen()" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600">
|
| 77 |
+
<i class="fas fa-history"></i>
|
| 78 |
+
</button>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
|
| 82 |
+
<!-- Input Form -->
|
| 83 |
+
<div class="flex-1 flex flex-col">
|
| 84 |
+
<div class="mb-6">
|
| 85 |
+
<label for="video-url" class="block text-sm font-medium mb-2">Video URL</label>
|
| 86 |
+
<div class="relative">
|
| 87 |
+
<input type="text" id="video-url" placeholder="Paste YouTube, TikTok, Instagram, etc. link here"
|
| 88 |
+
class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition-all">
|
| 89 |
+
<button onclick="pasteFromClipboard()" class="absolute right-2 top-1/2 transform -translate-y-1/2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 px-3 py-1 rounded-md text-sm transition-colors">
|
| 90 |
+
<i class="fas fa-paste mr-1"></i> Paste
|
| 91 |
+
</button>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
|
| 95 |
+
<div class="mb-6">
|
| 96 |
+
<label class="block text-sm font-medium mb-2">Download Format</label>
|
| 97 |
+
<div class="grid grid-cols-2 gap-4">
|
| 98 |
+
<button id="mp3-btn" onclick="selectFormat('mp3')" class="format-btn bg-indigo-100 dark:bg-indigo-900 border-2 border-indigo-300 dark:border-indigo-700 py-3 px-4 rounded-lg flex items-center justify-center transition-all hover:bg-indigo-200 dark:hover:bg-indigo-800">
|
| 99 |
+
<i class="fas fa-music mr-2"></i> MP3 (Audio)
|
| 100 |
+
</button>
|
| 101 |
+
<button id="mp4-btn" onclick="selectFormat('mp4')" class="format-btn bg-gray-100 dark:bg-gray-800 border-2 border-gray-300 dark:border-gray-700 py-3 px-4 rounded-lg flex items-center justify-center transition-all hover:bg-gray-200 dark:hover:bg-gray-700">
|
| 102 |
+
<i class="fas fa-video mr-2"></i> MP4 (Video)
|
| 103 |
+
</button>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div class="mt-auto">
|
| 108 |
+
<button id="download-btn" onclick="startDownload()" disabled class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-4 rounded-lg shadow-md transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center">
|
| 109 |
+
<i class="fas fa-download mr-2"></i> Download
|
| 110 |
+
</button>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<!-- Download Progress Screen -->
|
| 116 |
+
<div id="progress-screen" class="flex-1 flex flex-col items-center justify-center p-6 hidden">
|
| 117 |
+
<div class="text-center max-w-xs">
|
| 118 |
+
<div class="relative w-24 h-24 mb-6">
|
| 119 |
+
<div class="absolute inset-0 rounded-full border-4 border-indigo-200 dark:border-indigo-800"></div>
|
| 120 |
+
<div id="progress-circle" class="absolute inset-0 rounded-full border-4 border-indigo-500 border-t-indigo-500 border-r-indigo-500 animate-spin" style="clip: rect(0, 24px, 24px, 12px);"></div>
|
| 121 |
+
<div class="absolute inset-0 flex items-center justify-center">
|
| 122 |
+
<i id="progress-icon" class="fas fa-download text-indigo-500 text-2xl"></i>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<h3 id="progress-title" class="text-xl font-semibold mb-2">Preparing Download</h3>
|
| 127 |
+
<p id="progress-message" class="text-gray-600 dark:text-gray-300 mb-6">Validating your link...</p>
|
| 128 |
+
|
| 129 |
+
<div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5 mb-6">
|
| 130 |
+
<div id="progress-bar" class="bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<button onclick="cancelDownload()" class="text-indigo-600 dark:text-indigo-400 font-medium hover:underline">
|
| 134 |
+
Cancel
|
| 135 |
+
</button>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
<!-- History Screen -->
|
| 140 |
+
<div id="history-screen" class="flex-1 flex flex-col p-6 hidden">
|
| 141 |
+
<div class="flex justify-between items-center mb-6">
|
| 142 |
+
<h2 class="text-2xl font-bold text-indigo-600 dark:text-indigo-400">Download History</h2>
|
| 143 |
+
<button onclick="showMainScreen()" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600">
|
| 144 |
+
<i class="fas fa-arrow-left"></i>
|
| 145 |
+
</button>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div class="flex-1 overflow-y-auto">
|
| 149 |
+
<div id="history-list" class="space-y-3">
|
| 150 |
+
<!-- History items will be added here dynamically -->
|
| 151 |
+
<div class="text-center py-10 text-gray-500" id="empty-history">
|
| 152 |
+
<i class="fas fa-history text-4xl mb-3 opacity-30"></i>
|
| 153 |
+
<p>Your download history is empty</p>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
|
| 159 |
+
<!-- Settings Menu -->
|
| 160 |
+
<div id="settings-menu" class="absolute inset-0 bg-white dark:bg-gray-800 shadow-lg z-10 hidden flex-col p-6">
|
| 161 |
+
<div class="flex justify-between items-center mb-8">
|
| 162 |
+
<h2 class="text-2xl font-bold text-indigo-600 dark:text-indigo-400">Settings</h2>
|
| 163 |
+
<button onclick="hideSettingsMenu()" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600">
|
| 164 |
+
<i class="fas fa-times"></i>
|
| 165 |
+
</button>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="space-y-6">
|
| 169 |
+
<div>
|
| 170 |
+
<h3 class="font-medium mb-3">Appearance</h3>
|
| 171 |
+
<div class="flex items-center justify-between">
|
| 172 |
+
<span>Dark Mode</span>
|
| 173 |
+
<label class="relative inline-flex items-center cursor-pointer">
|
| 174 |
+
<input type="checkbox" id="dark-mode-toggle" class="sr-only peer">
|
| 175 |
+
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-indigo-300 dark:peer-focus:ring-indigo-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-indigo-600"></div>
|
| 176 |
+
</label>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
<div>
|
| 181 |
+
<h3 class="font-medium mb-3">Download Options</h3>
|
| 182 |
+
<div class="space-y-4">
|
| 183 |
+
<div class="flex items-center justify-between">
|
| 184 |
+
<span>Default Format</span>
|
| 185 |
+
<select class="bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 text-gray-800 dark:text-gray-200 rounded-md px-3 py-1 text-sm">
|
| 186 |
+
<option>MP3</option>
|
| 187 |
+
<option>MP4</option>
|
| 188 |
+
</select>
|
| 189 |
+
</div>
|
| 190 |
+
<div class="flex items-center justify-between">
|
| 191 |
+
<span>Video Quality</span>
|
| 192 |
+
<select class="bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 text-gray-800 dark:text-gray-200 rounded-md px-3 py-1 text-sm">
|
| 193 |
+
<option>720p (Recommended)</option>
|
| 194 |
+
<option>480p</option>
|
| 195 |
+
<option>360p</option>
|
| 196 |
+
</select>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
</div>
|
| 200 |
+
|
| 201 |
+
<div>
|
| 202 |
+
<h3 class="font-medium mb-3">About</h3>
|
| 203 |
+
<p class="text-sm text-gray-600 dark:text-gray-300">App mp3_mp4 - Designed to simplify your downloads</p>
|
| 204 |
+
<p class="text-sm text-gray-500 mt-2">Version 1.0.0</p>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
|
| 208 |
+
<div class="mt-auto pt-6">
|
| 209 |
+
<button class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-3 px-4 rounded-lg shadow-md transition-all">
|
| 210 |
+
Save Settings
|
| 211 |
+
</button>
|
| 212 |
+
</div>
|
| 213 |
+
</div>
|
| 214 |
+
</div>
|
| 215 |
+
|
| 216 |
+
<script>
|
| 217 |
+
// App state
|
| 218 |
+
let currentFormat = null;
|
| 219 |
+
let downloadInProgress = false;
|
| 220 |
+
let downloadHistory = JSON.parse(localStorage.getItem('downloadHistory')) || [];
|
| 221 |
+
|
| 222 |
+
// DOM elements
|
| 223 |
+
const welcomeScreen = document.getElementById('welcome-screen');
|
| 224 |
+
const mainScreen = document.getElementById('main-screen');
|
| 225 |
+
const progressScreen = document.getElementById('progress-screen');
|
| 226 |
+
const historyScreen = document.getElementById('history-screen');
|
| 227 |
+
const settingsMenu = document.getElementById('settings-menu');
|
| 228 |
+
const downloadBtn = document.getElementById('download-btn');
|
| 229 |
+
const videoUrlInput = document.getElementById('video-url');
|
| 230 |
+
const progressBar = document.getElementById('progress-bar');
|
| 231 |
+
const progressTitle = document.getElementById('progress-title');
|
| 232 |
+
const progressMessage = document.getElementById('progress-message');
|
| 233 |
+
const progressCircle = document.getElementById('progress-circle');
|
| 234 |
+
const progressIcon = document.getElementById('progress-icon');
|
| 235 |
+
const historyList = document.getElementById('history-list');
|
| 236 |
+
const emptyHistory = document.getElementById('empty-history');
|
| 237 |
+
const darkModeToggle = document.getElementById('dark-mode-toggle');
|
| 238 |
+
|
| 239 |
+
// Initialize app
|
| 240 |
+
function initApp() {
|
| 241 |
+
// Check for dark mode preference
|
| 242 |
+
if (localStorage.getItem('darkMode') === 'true' ||
|
| 243 |
+
(!localStorage.getItem('darkMode') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
| 244 |
+
document.documentElement.classList.add('dark');
|
| 245 |
+
darkModeToggle.checked = true;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Load history
|
| 249 |
+
renderHistory();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// Screen navigation
|
| 253 |
+
function showMainScreen() {
|
| 254 |
+
welcomeScreen.classList.add('hidden');
|
| 255 |
+
mainScreen.classList.remove('hidden');
|
| 256 |
+
progressScreen.classList.add('hidden');
|
| 257 |
+
historyScreen.classList.add('hidden');
|
| 258 |
+
settingsMenu.classList.add('hidden');
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
function showProgressScreen() {
|
| 262 |
+
mainScreen.classList.add('hidden');
|
| 263 |
+
progressScreen.classList.remove('hidden');
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
function showHistoryScreen() {
|
| 267 |
+
mainScreen.classList.add('hidden');
|
| 268 |
+
historyScreen.classList.remove('hidden');
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
function showSettingsMenu() {
|
| 272 |
+
settingsMenu.classList.remove('hidden');
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
function hideSettingsMenu() {
|
| 276 |
+
settingsMenu.classList.add('hidden');
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
// Format selection
|
| 280 |
+
function selectFormat(format) {
|
| 281 |
+
currentFormat = format;
|
| 282 |
+
|
| 283 |
+
// Update button styles
|
| 284 |
+
document.querySelectorAll('.format-btn').forEach(btn => {
|
| 285 |
+
btn.classList.remove('border-indigo-300', 'dark:border-indigo-700', 'bg-indigo-100', 'dark:bg-indigo-900');
|
| 286 |
+
btn.classList.add('border-gray-300', 'dark:border-gray-700', 'bg-gray-100', 'dark:bg-gray-800');
|
| 287 |
+
});
|
| 288 |
+
|
| 289 |
+
const selectedBtn = document.getElementById(`${format}-btn`);
|
| 290 |
+
selectedBtn.classList.remove('border-gray-300', 'dark:border-gray-700', 'bg-gray-100', 'dark:bg-gray-800');
|
| 291 |
+
selectedBtn.classList.add('border-indigo-300', 'dark:border-indigo-700', 'bg-indigo-100', 'dark:bg-indigo-900');
|
| 292 |
+
|
| 293 |
+
// Enable download button if URL is present
|
| 294 |
+
updateDownloadButtonState();
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
// Update download button state
|
| 298 |
+
function updateDownloadButtonState() {
|
| 299 |
+
const url = videoUrlInput.value.trim();
|
| 300 |
+
downloadBtn.disabled = !(url && currentFormat);
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
// Paste from clipboard
|
| 304 |
+
function pasteFromClipboard() {
|
| 305 |
+
navigator.clipboard.readText().then(text => {
|
| 306 |
+
videoUrlInput.value = text;
|
| 307 |
+
updateDownloadButtonState();
|
| 308 |
+
}).catch(err => {
|
| 309 |
+
console.error('Failed to read clipboard:', err);
|
| 310 |
+
// Fallback for browsers that don't support clipboard API
|
| 311 |
+
videoUrlInput.value = '';
|
| 312 |
+
videoUrlInput.placeholder = "Paste not supported, type manually";
|
| 313 |
+
});
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
// Start download process
|
| 317 |
+
function startDownload() {
|
| 318 |
+
const url = videoUrlInput.value.trim();
|
| 319 |
+
if (!url || !currentFormat) return;
|
| 320 |
+
|
| 321 |
+
showProgressScreen();
|
| 322 |
+
downloadInProgress = true;
|
| 323 |
+
|
| 324 |
+
// Simulate download process (in a real app, this would call your API)
|
| 325 |
+
simulateDownloadProcess(url, currentFormat);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
// Cancel download
|
| 329 |
+
function cancelDownload() {
|
| 330 |
+
downloadInProgress = false;
|
| 331 |
+
progressTitle.textContent = 'Download Cancelled';
|
| 332 |
+
progressMessage.textContent = 'The download was cancelled by the user';
|
| 333 |
+
progressIcon.className = 'fas fa-times-circle text-red-500 text-2xl';
|
| 334 |
+
progressBar.style.width = '0%';
|
| 335 |
+
|
| 336 |
+
setTimeout(() => {
|
| 337 |
+
showMainScreen();
|
| 338 |
+
}, 2000);
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// Simulate download process (replace with actual API call)
|
| 342 |
+
function simulateDownloadProcess(url, format) {
|
| 343 |
+
// Validation phase
|
| 344 |
+
progressTitle.textContent = 'Validating Link';
|
| 345 |
+
progressMessage.textContent = 'Checking if the URL is valid...';
|
| 346 |
+
progressBar.style.width = '10%';
|
| 347 |
+
|
| 348 |
+
setTimeout(() => {
|
| 349 |
+
if (!isValidUrl(url)) {
|
| 350 |
+
downloadInProgress = false;
|
| 351 |
+
progressTitle.textContent = 'Invalid Link';
|
| 352 |
+
progressMessage.textContent = 'Please check the URL and try again';
|
| 353 |
+
progressIcon.className = 'fas fa-exclamation-circle text-red-500 text-2xl';
|
| 354 |
+
progressBar.style.width = '0%';
|
| 355 |
+
|
| 356 |
+
setTimeout(() => {
|
| 357 |
+
showMainScreen();
|
| 358 |
+
}, 2000);
|
| 359 |
+
return;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
// Download phase
|
| 363 |
+
progressTitle.textContent = 'Downloading';
|
| 364 |
+
progressMessage.textContent = `Preparing ${format.toUpperCase()} file...`;
|
| 365 |
+
progressBar.style.width = '30%';
|
| 366 |
+
|
| 367 |
+
setTimeout(() => {
|
| 368 |
+
progressBar.style.width = '60%';
|
| 369 |
+
progressMessage.textContent = 'Processing media...';
|
| 370 |
+
|
| 371 |
+
setTimeout(() => {
|
| 372 |
+
// Completion phase
|
| 373 |
+
downloadInProgress = false;
|
| 374 |
+
progressBar.style.width = '100%';
|
| 375 |
+
progressTitle.textContent = 'Download Complete';
|
| 376 |
+
progressMessage.textContent = `Your ${format.toUpperCase()} file is ready`;
|
| 377 |
+
progressIcon.className = 'fas fa-check-circle text-green-500 text-2xl';
|
| 378 |
+
|
| 379 |
+
// Add to history
|
| 380 |
+
addToHistory(url, format);
|
| 381 |
+
|
| 382 |
+
setTimeout(() => {
|
| 383 |
+
showMainScreen();
|
| 384 |
+
progressBar.style.width = '0%';
|
| 385 |
+
}, 2000);
|
| 386 |
+
}, 1500);
|
| 387 |
+
}, 1500);
|
| 388 |
+
}, 1500);
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
// Validate URL (simplified for demo)
|
| 392 |
+
function isValidUrl(url) {
|
| 393 |
+
try {
|
| 394 |
+
new URL(url);
|
| 395 |
+
return true;
|
| 396 |
+
} catch (e) {
|
| 397 |
+
return false;
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
// History management
|
| 402 |
+
function addToHistory(url, format) {
|
| 403 |
+
const entry = {
|
| 404 |
+
id: Date.now(),
|
| 405 |
+
url,
|
| 406 |
+
format,
|
| 407 |
+
title: `Downloaded ${format.toUpperCase()} from ${extractDomain(url)}`,
|
| 408 |
+
date: new Date().toLocaleString(),
|
| 409 |
+
filename: `media_${Date.now()}.${format}`
|
| 410 |
+
};
|
| 411 |
+
|
| 412 |
+
downloadHistory.unshift(entry);
|
| 413 |
+
localStorage.setItem('downloadHistory', JSON.stringify(downloadHistory));
|
| 414 |
+
renderHistory();
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
function renderHistory() {
|
| 418 |
+
if (downloadHistory.length === 0) {
|
| 419 |
+
emptyHistory.classList.remove('hidden');
|
| 420 |
+
return;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
emptyHistory.classList.add('hidden');
|
| 424 |
+
historyList.innerHTML = '';
|
| 425 |
+
|
| 426 |
+
downloadHistory.forEach(entry => {
|
| 427 |
+
const historyItem = document.createElement('div');
|
| 428 |
+
historyItem.className = 'bg-white dark:bg-gray-800 p-4 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700';
|
| 429 |
+
historyItem.innerHTML = `
|
| 430 |
+
<div class="flex justify-between items-start mb-2">
|
| 431 |
+
<h3 class="font-medium truncate">${entry.title}</h3>
|
| 432 |
+
<span class="text-xs text-gray-500 ml-2 whitespace-nowrap">${entry.date}</span>
|
| 433 |
+
</div>
|
| 434 |
+
<div class="flex items-center justify-between text-sm">
|
| 435 |
+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 dark:bg-indigo-900 text-indigo-800 dark:text-indigo-200">
|
| 436 |
+
${entry.format.toUpperCase()}
|
| 437 |
+
</span>
|
| 438 |
+
<div class="space-x-2">
|
| 439 |
+
<button onclick="playMedia('${entry.filename}')" class="text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-300">
|
| 440 |
+
<i class="fas fa-play"></i> Play
|
| 441 |
+
</button>
|
| 442 |
+
<button onclick="showInFolder('${entry.filename}')" class="text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300">
|
| 443 |
+
<i class="fas fa-folder-open"></i> Folder
|
| 444 |
+
</button>
|
| 445 |
+
</div>
|
| 446 |
+
</div>
|
| 447 |
+
`;
|
| 448 |
+
historyList.appendChild(historyItem);
|
| 449 |
+
});
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
// Simulate media actions
|
| 453 |
+
function playMedia(filename) {
|
| 454 |
+
alert(`In a real app, this would play: ${filename}`);
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
function showInFolder(filename) {
|
| 458 |
+
alert(`In a real app, this would open folder containing: ${filename}`);
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
// Extract domain from URL
|
| 462 |
+
function extractDomain(url) {
|
| 463 |
+
try {
|
| 464 |
+
const domain = new URL(url).hostname.replace('www.', '');
|
| 465 |
+
return domain.split('.')[0];
|
| 466 |
+
} catch (e) {
|
| 467 |
+
return 'unknown';
|
| 468 |
+
}
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// Dark mode toggle
|
| 472 |
+
function toggleDarkMode() {
|
| 473 |
+
const isDark = document.documentElement.classList.toggle('dark');
|
| 474 |
+
localStorage.setItem('darkMode', isDark);
|
| 475 |
+
darkModeToggle.checked = isDark;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
// Event listeners
|
| 479 |
+
videoUrlInput.addEventListener('input', updateDownloadButtonState);
|
| 480 |
+
darkModeToggle.addEventListener('change', toggleDarkMode);
|
| 481 |
+
|
| 482 |
+
// Initialize
|
| 483 |
+
document.addEventListener('DOMContentLoaded', initApp);
|
| 484 |
+
</script>
|
| 485 |
+
<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=AllBajo/mp3-mp4" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 486 |
+
</html>
|