File size: 29,410 Bytes
cdb9977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Scrapee - Video Scraper vers TeraBox</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .progress-bar {
            transition: width 0.3s ease;
        }
        .video-thumbnail {
            transition: all 0.2s ease;
        }
        .video-thumbnail:hover {
            transform: scale(1.02);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
    </style>
</head>
<body class="bg-gray-100 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <header class="bg-gradient-to-r from-blue-600 to-indigo-800 text-white rounded-xl shadow-lg p-6 mb-8">
            <div class="flex items-center justify-between">
                <div>
                    <h1 class="text-3xl font-bold"><i class="fas fa-cloud-download-alt mr-3"></i>Scrapee</h1>
                    <p class="mt-2 opacity-90">Téléchargez des vidéos depuis des sites protégés et envoyez-les directement sur votre TeraBox</p>
                </div>
                <div class="bg-white text-blue-600 p-3 rounded-lg shadow-md">
                    <i class="fas fa-cloud-upload-alt text-3xl"></i>
                </div>
            </div>
        </header>

        <!-- Main Content -->
        <div class="bg-white rounded-xl shadow-lg overflow-hidden">
            <!-- Tabs Navigation -->
            <div class="flex border-b">
                <button class="tab-btn py-4 px-6 font-medium text-gray-600 hover:text-blue-600 focus:outline-none border-b-2 border-transparent hover:border-blue-300 transition" data-tab="login">
                    <i class="fas fa-sign-in-alt mr-2"></i>Connexion
                </button>
                <button class="tab-btn py-4 px-6 font-medium text-gray-600 hover:text-blue-600 focus:outline-none border-b-2 border-transparent hover:border-blue-300 transition" data-tab="scraper">
                    <i class="fas fa-download mr-2"></i>Scraper Vidéo
                </button>
                <button class="tab-btn py-4 px-6 font-medium text-gray-600 hover:text-blue-600 focus:outline-none border-b-2 border-transparent hover:border-blue-300 transition" data-tab="terabox">
                    <i class="fas fa-cloud mr-2"></i>TeraBox
                </button>
                <button class="tab-btn py-4 px-6 font-medium text-gray-600 hover:text-blue-600 focus:outline-none border-b-2 border-transparent hover:border-blue-300 transition" data-tab="settings">
                    <i class="fas fa-cog mr-2"></i>Paramètres
                </button>
            </div>

            <!-- Tab Contents -->
            <div class="p-6">
                <!-- Login Tab -->
                <div id="login" class="tab-content active">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6"><i class="fas fa-user-lock mr-2"></i>Connexion aux Sites Protégés</h2>
                    
                    <div class="grid md:grid-cols-2 gap-6">
                        <!-- Site Credentials Form -->
                        <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                            <h3 class="text-lg font-semibold text-gray-700 mb-4">Identifiants du Site</h3>
                            <div class="space-y-4">
                                <div>
                                    <label for="site-url" class="block text-sm font-medium text-gray-700 mb-1">URL du Site</label>
                                    <input type="url" id="site-url" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="https://exemple.com">
                                </div>
                                <div>
                                    <label for="username" class="block text-sm font-medium text-gray-700 mb-1">Nom d'utilisateur</label>
                                    <input type="text" id="username" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="Votre identifiant">
                                </div>
                                <div>
                                    <label for="password" class="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label>
                                    <input type="password" id="password" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="Votre mot de passe">
                                </div>
                                <div class="pt-2">
                                    <button id="save-creds-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md transition flex items-center justify-center">
                                        <i class="fas fa-save mr-2"></i> Enregistrer les identifiants
                                    </button>
                                </div>
                            </div>
                        </div>

                        <!-- Saved Credentials List -->
                        <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                            <h3 class="text-lg font-semibold text-gray-700 mb-4">Identifiants Enregistrés</h3>
                            <div class="overflow-y-auto max-h-64">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead class="bg-gray-100">
                                        <tr>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Site</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Utilisateur</th>
                                            <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody id="saved-creds-list" class="bg-white divide-y divide-gray-200">
                                        <!-- Example entry -->
                                        <tr>
                                            <td colspan="3" class="px-4 py-4 text-center text-sm text-gray-500">Aucun identifiant enregistré</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Scraper Tab -->
                <div id="scraper" class="tab-content">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6"><i class="fas fa-download mr-2"></i>Scraper des Vidéos</h2>
                    
                    <div class="grid md:grid-cols-3 gap-6">
                        <!-- Video URL Input -->
                        <div class="md:col-span-2 bg-gray-50 p-6 rounded-lg border border-gray-200">
                            <h3 class="text-lg font-semibold text-gray-700 mb-4">URL de la Vidéo</h3>
                            <div class="flex space-x-2">
                                <input type="url" id="video-url" class="flex-1 px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="https://exemple.com/video/123">
                                <button id="fetch-video-btn" class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md transition flex items-center">
                                    <i class="fas fa-search mr-2"></i> Chercher
                                </button>
                            </div>
                            
                            <div id="video-info" class="mt-6 hidden">
                                <div class="flex items-start space-x-4">
                                    <div class="video-thumbnail flex-shrink-0 w-48 h-32 bg-gray-200 rounded-md overflow-hidden">
                                        <img id="video-thumb" src="" alt="Miniature" class="w-full h-full object-cover">
                                    </div>
                                    <div class="flex-1">
                                        <h4 id="video-title" class="font-bold text-lg text-gray-800"></h4>
                                        <p id="video-duration" class="text-sm text-gray-600 mt-1"></p>
                                        <p id="video-quality" class="text-sm text-gray-600"></p>
                                        <div class="mt-3">
                                    <button id="download-video-btn" class="bg-green-600 hover:bg-green-700 text-white py-1 px-3 rounded-md text-sm transition flex items-center">
                                        <i class="fas fa-download mr-1"></i> Télécharger
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div id="download-progress" class="mt-6 hidden">
                        <h4 class="font-medium text-gray-700 mb-2">Progression du téléchargement</h4>
                        <div class="w-full bg-gray-200 rounded-full h-2.5">
                            <div id="progress-bar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
                        </div>
                        <p id="progress-text" class="text-sm text-gray-600 mt-1">0%</p>
                    </div>
                </div>
                
                <!-- Download Queue -->
                <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-700 mb-4">File d'attente</h3>
                    <div id="download-queue" class="space-y-3 max-h-96 overflow-y-auto">
                        <div class="text-center text-sm text-gray-500 py-4">Aucun téléchargement en file d'attente</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- TeraBox Tab -->
        <div id="terabox" class="tab-content">
            <h2 class="text-2xl font-bold text-gray-800 mb-6"><i class="fas fa-cloud mr-2"></i>Connexion à TeraBox</h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <!-- TeraBox Login -->
                <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-700 mb-4">Identifiants TeraBox</h3>
                    <div class="space-y-4">
                        <div>
                            <label for="terabox-email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
                            <input type="email" id="terabox-email" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="email@exemple.com">
                        </div>
                        <div>
                            <label for="terabox-password" class="block text-sm font-medium text-gray-700 mb-1">Mot de passe</label>
                            <input type="password" id="terabox-password" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="Votre mot de passe">
                        </div>
                        <div class="pt-2">
                            <button id="terabox-login-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md transition flex items-center justify-center">
                                <i class="fas fa-sign-in-alt mr-2"></i> Se connecter
                            </button>
                        </div>
                    </div>
                </div>
                
                <!-- Upload to TeraBox -->
                <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-700 mb-4">Envoyer vers TeraBox</h3>
                    <div id="terabox-upload-section" class="hidden">
                        <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center">
                            <i class="fas fa-cloud-upload-alt text-4xl text-blue-500 mb-3"></i>
                            <p class="text-gray-600 mb-4">Glissez-déposez vos fichiers vidéo ici ou cliquez pour sélectionner</p>
                            <input type="file" id="terabox-file-input" class="hidden" multiple>
                            <button id="terabox-select-files" class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md transition">
                                <i class="fas fa-folder-open mr-2"></i> Sélectionner des fichiers
                            </button>
                        </div>
                        
                        <div id="terabox-upload-progress" class="mt-6 hidden">
                            <h4 class="font-medium text-gray-700 mb-2">Progression de l'envoi</h4>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div id="terabox-progress-bar" class="progress-bar bg-green-600 h-2.5 rounded-full" style="width: 0%"></div>
                            </div>
                            <p id="terabox-progress-text" class="text-sm text-gray-600 mt-1">0%</p>
                        </div>
                        
                        <div id="terabox-uploaded-files" class="mt-6 space-y-2 max-h-48 overflow-y-auto">
                            <!-- Uploaded files will appear here -->
                        </div>
                    </div>
                    
                    <div id="terabox-not-connected" class="text-center py-8">
                        <i class="fas fa-cloud-slash text-4xl text-gray-400 mb-3"></i>
                        <p class="text-gray-600">Connectez-vous à TeraBox pour envoyer des fichiers</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- Settings Tab -->
        <div id="settings" class="tab-content">
            <h2 class="text-2xl font-bold text-gray-800 mb-6"><i class="fas fa-cog mr-2"></i>Paramètres</h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <!-- General Settings -->
                <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-700 mb-4">Paramètres Généraux</h3>
                    <div class="space-y-4">
                        <div>
                            <label for="download-folder" class="block text-sm font-medium text-gray-700 mb-1">Dossier de téléchargement</label>
                            <input type="text" id="download-folder" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="C:/Downloads">
                        </div>
                        <div>
                            <label for="max-concurrent" class="block text-sm font-medium text-gray-700 mb-1">Téléchargements simultanés</label>
                            <select id="max-concurrent" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                <option value="1">1</option>
                                <option value="2" selected>2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </div>
                        <div class="flex items-center">
                            <input type="checkbox" id="auto-upload" class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
                            <label for="auto-upload" class="ml-2 block text-sm text-gray-700">Envoyer automatiquement à TeraBox après téléchargement</label>
                        </div>
                    </div>
                </div>
                
                <!-- Advanced Settings -->
                <div class="bg-gray-50 p-6 rounded-lg border border-gray-200">
                    <h3 class="text-lg font-semibold text-gray-700 mb-4">Paramètres Avancés</h3>
                    <div class="space-y-4">
                        <div>
                            <label for="proxy-settings" class="block text-sm font-medium text-gray-700 mb-1">Paramètres de proxy</label>
                            <input type="text" id="proxy-settings" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" placeholder="http://proxy:port">
                        </div>
                        <div>
                            <label for="user-agent" class="block text-sm font-medium text-gray-700 mb-1">User-Agent</label>
                            <select id="user-agent" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500">
                                <option value="default">Navigateur par défaut</option>
                                <option value="chrome">Chrome (Windows)</option>
                                <option value="firefox">Firefox (Mac)</option>
                                <option value="mobile">Mobile (Android)</option>
                                <option value="custom">Personnalisé</option>
                            </select>
                        </div>
                        <div id="custom-user-agent" class="hidden">
                            <input type="text" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500 mt-1" placeholder="Entrez votre User-Agent personnalisé">
                        </div>
                        <div class="pt-4">
                            <button id="save-settings-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-md transition">
                                <i class="fas fa-save mr-2"></i> Enregistrer les paramètres
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Status Bar -->
    <div class="mt-6 bg-white rounded-xl shadow-md p-3 flex items-center justify-between">
        <div class="flex items-center space-x-2">
            <div id="connection-status" class="w-3 h-3 rounded-full bg-green-500"></div>
            <span class="text-sm text-gray-600">Connecté</span>
        </div>
        <div class="text-sm text-gray-600">
            <span id="download-count">0</span> téléchargements en cours
        </div>
        <div class="text-sm text-gray-600">
            <span id="storage-usage">0 MB</span> utilisés
        </div>
    </div>
</div>

<script>
    // Tab switching functionality
    document.querySelectorAll('.tab-btn').forEach(btn => {
        btn.addEventListener('click', () => {
            // Remove active class from all tabs and buttons
            document.querySelectorAll('.tab-btn').forEach(b => {
                b.classList.remove('border-blue-600', 'text-blue-600');
                b.classList.add('text-gray-600');
            });
            
            document.querySelectorAll('.tab-content').forEach(content => {
                content.classList.remove('active');
            });
            
            // Add active class to clicked tab
            btn.classList.add('border-blue-600', 'text-blue-600');
            btn.classList.remove('text-gray-600');
            
            const tabId = btn.getAttribute('data-tab');
            document.getElementById(tabId).classList.add('active');
        });
    });

    // User agent selection
    document.getElementById('user-agent').addEventListener('change', function() {
        const customUA = document.getElementById('custom-user-agent');
        if (this.value === 'custom') {
            customUA.classList.remove('hidden');
        } else {
            customUA.classList.add('hidden');
        }
    });

    // Save credentials button
    document.getElementById('save-creds-btn').addEventListener('click', function() {
        const siteUrl = document.getElementById('site-url').value;
        const username = document.getElementById('username').value;
        const password = document.getElementById('password').value;
        
        if (!siteUrl || !username || !password) {
            alert('Veuillez remplir tous les champs');
            return;
        }
        
        // In a real app, you would save these securely (possibly encrypted)
        alert(`Identifiants enregistrés pour ${siteUrl}`);
        
        // Clear fields
        document.getElementById('site-url').value = '';
        document.getElementById('username').value = '';
        document.getElementById('password').value = '';
        
        // Add to saved credentials list (simplified example)
        const tbody = document.getElementById('saved-creds-list');
        if (tbody.firstElementChild && tbody.firstElementChild.getAttribute('colspan')) {
            tbody.innerHTML = '';
        }
        
        const tr = document.createElement('tr');
        tr.innerHTML = `
            <td class="px-4 py-2 text-sm text-gray-800">${new URL(siteUrl).hostname}</td>
            <td class="px-4 py-2 text-sm text-gray-800">${username}</td>
            <td class="px-4 py-2 text-sm text-gray-800">
                <button class="text-blue-600 hover:text-blue-800 mr-2"><i class="fas fa-edit"></i></button>
                <button class="text-red-600 hover:text-red-800"><i class="fas fa-trash"></i></button>
            </td>
        `;
        tbody.appendChild(tr);
    });

    // Fetch video button
    document.getElementById('fetch-video-btn').addEventListener('click', function() {
        const videoUrl = document.getElementById('video-url').value;
        
        if (!videoUrl) {
            alert('Veuillez entrer une URL de vidéo');
            return;
        }
        
        // Simulate fetching video info
        document.getElementById('video-info').classList.remove('hidden');
        document.getElementById('video-thumb').src = 'https://via.placeholder.com/400x225';
        document.getElementById('video-title').textContent = 'Exemple de vidéo';
        document.getElementById('video-duration').textContent = 'Durée: 10:30';
        document.getElementById('video-quality').textContent = 'Qualité: 1080p';
        
        // In a real app, you would make an API call to your backend to scrape the video
    });

    // Download video button
    document.getElementById('download-video-btn').addEventListener('click', function() {
        // Show progress bar
        document.getElementById('download-progress').classList.remove('hidden');
        
        // Simulate download progress
        let progress = 0;
        const progressBar = document.getElementById('progress-bar');
        const progressText = document.getElementById('progress-text');
        
        const interval = setInterval(() => {
            progress += Math.random() * 10;
            if (progress > 100) progress = 100;
            
            progressBar.style.width = `${progress}%`;
            progressText.textContent = `${Math.round(progress)}%`;
            
            if (progress === 100) {
                clearInterval(interval);
                
                // Add to download queue (simplified example)
                const queue = document.getElementById('download-queue');
                if (queue.firstElementChild && queue.firstElementChild.classList.contains('text-center')) {
                    queue.innerHTML = '';
                }
                
                const item = document.createElement('div');
                item.className = 'bg-gray-100 p-3 rounded-md flex items-center justify-between';
                item.innerHTML = `
                    <div class="flex items-center space-x-3">
                        <i class="fas fa-video text-blue-500"></i>
                        <span class="text-sm font-medium">Exemple de vidéo.mp4</span>
                    </div>
                    <div class="text-green-500 text-sm">
                        <i class="fas fa-check-circle"></i> Terminé
                    </div>
                `;
                queue.appendChild(item);
                
                // Update download count
                const countElement = document.getElementById('download-count');
                let count = parseInt(countElement.textContent);
                countElement.textContent = count + 1;
            }
        }, 300);
    });

    // TeraBox login
    document.getElementById('terabox-login-btn').addEventListener('click', function() {
        const email = document.getElementById('terabox-email').value;
        const password = document.getElementById('terabox-password').value;
        
        if (!email || !password) {
            alert('Veuillez entrer votre email et mot de passe TeraBox');
            return;
        }
        
        // Simulate login
        alert(`Connecté à TeraBox avec ${email}`);
        
        // Show upload section
        document.getElementById('terabox-upload-section').classList.remove('hidden');
        document.getElementById('terabox-not-connected').classList.add('hidden');
    });

    // Select files for TeraBox
    document.getElementById('terabox-select-files').addEventListener('click', function() {
        document.getElementById('terabox-file-input').click();
    });
    
    document.getElementById('terabox-file-input').addEventListener('change', function() {
        if (this.files.length > 0) {
            // Show upload progress
            document.getElementById('terabox-upload-progress').classList.remove('hidden');
            
            // Simulate upload progress
            let progress = 0;
            const progressBar = document.getElementById('terabox-progress-bar');
            const progressText = document.getElementById('terabox-progress-text');
            
            const interval = setInterval(() => {
                progress += Math.random() * 10;
                if (progress > 100) progress = 100;
                
                progressBar.style.width = `${progress}%`;
                progressText.textContent = `${Math.round(progress)}%`;
                
                if (progress === 100) {
                    clearInterval(interval);
                    
                    // Add to uploaded files list
                    const uploadedFiles = document.getElementById('terabox-uploaded-files');
                    
                    for (let file of this.files) {
                        const item = document.createElement('div');
                        item.className = 'bg-gray-100 p-3 rounded-md flex items-center justify-between';
                        item.innerHTML = `
                            <div class="flex items-center space-x-3 truncate">
                                <i class="fas fa-file-video text-green-500 flex-shrink-0"></i>
                                <span class="text-sm font-medium truncate">${file.name}</span>
                            </div>
                            <div class="text-green-500 text-sm flex-shrink-0">
                                <i class="fas fa-check-circle"></i> Envoyé
                            </div>
                        `;
                        uploadedFiles.appendChild(item);
                    }
                }
            }, 300);
        }
    });

    // Save settings
    document.getElementById('save-settings-btn').addEventListener('click', function() {
        alert('Paramètres enregistrés avec succès');
    });
</script>
<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=SaintCrocs/scrapee" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>