-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
1129 lines (997 loc) · 59.5 KB
/
Copy pathindex.html
File metadata and controls
1129 lines (997 loc) · 59.5 KB
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
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Media Scraper Pro - Movies & TV Series</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Alpine.js -->
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<!-- Font Awesome for icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- JSZip for creating zip files -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<!-- FileSaver.js for downloading files -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<style>
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
background: #4a4a4a;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #5a5a5a;
}
/* Loading animation */
@keyframes pulse-opacity {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.loading-pulse {
animation: pulse-opacity 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
/* Gradient animations */
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.animated-gradient {
background: linear-gradient(270deg, #667eea, #764ba2, #f093fb);
background-size: 200% 200%;
animation: gradient-shift 3s ease infinite;
}
/* Tab indicator animation */
.tab-indicator {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Card hover effects */
.card-hover {
transition: all 0.3s ease;
}
.card-hover:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
/* Smooth transitions */
.transition-smooth {
transition: all 0.2s ease;
}
/* Glow effect */
.glow {
box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}
</style>
<script>
// Tailwind config for dark mode
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
'dark-primary': '#1e1e1e',
'dark-secondary': '#252525',
'dark-tertiary': '#2d2d2d',
'dark-border': '#404040',
'movie-blue': '#4a9eff',
'series-purple': '#9b59b6',
}
}
}
}
</script>
</head>
<body class="bg-dark-primary text-gray-200 min-h-screen">
<div x-data="mediaApp()" x-init="init()" class="container mx-auto px-4 py-6 max-w-7xl">
<!-- Enhanced Header with Animation -->
<header class="bg-dark-secondary rounded-lg p-6 mb-6 shadow-2xl overflow-hidden relative">
<div class="absolute inset-0 animated-gradient opacity-10"></div>
<div class="relative flex items-center justify-between flex-wrap gap-4">
<h1 class="text-3xl md:text-4xl font-bold flex items-center gap-3">
<span class="text-4xl animate-pulse">🎬</span>
<span class="bg-gradient-to-r from-blue-400 to-purple-600 bg-clip-text text-transparent">
Media Scraper Pro
</span>
</h1>
<div class="flex items-center gap-4">
<div class="text-sm text-gray-400">
<i class="fas fa-globe mr-1"></i>
<span>Web Edition</span>
</div>
<div class="flex items-center gap-2">
<span class="inline-block w-2 h-2 bg-green-400 rounded-full animate-pulse"></span>
<span class="text-xs text-gray-400">API Connected</span>
</div>
</div>
</div>
</header>
<!-- Enhanced Media Type Selector with Icons and Colors -->
<div class="bg-dark-secondary rounded-lg mb-6 shadow-xl overflow-hidden">
<div class="flex relative">
<!-- Animated Tab Indicator -->
<div class="absolute bottom-0 h-1 tab-indicator"
:class="activeTab === 'movies' ? 'bg-movie-blue' : 'bg-series-purple'"
:style="`transform: translateX(${activeTab === 'movies' ? '0' : '100'}%); width: 50%;`">
</div>
<!-- Movie Tab -->
<button @click="switchTab('movies')"
:class="activeTab === 'movies' ? 'bg-dark-tertiary text-movie-blue' : 'text-gray-400 hover:text-gray-200 hover:bg-dark-tertiary'"
class="flex-1 py-5 px-6 transition-smooth relative group">
<div class="flex items-center justify-center gap-3">
<div class="text-3xl transform group-hover:scale-110 transition-smooth">
<i class="fas fa-film"></i>
</div>
<div>
<div class="font-bold text-lg">Movies</div>
<div class="text-xs opacity-75">Feature Films</div>
</div>
</div>
<div x-show="activeTab === 'movies'"
x-transition
class="absolute top-0 right-4 text-xs bg-movie-blue text-white px-2 py-1 rounded-full">
Active
</div>
</button>
<!-- TV Series Tab -->
<button @click="switchTab('series')"
:class="activeTab === 'series' ? 'bg-dark-tertiary text-series-purple' : 'text-gray-400 hover:text-gray-200 hover:bg-dark-tertiary'"
class="flex-1 py-5 px-6 transition-smooth relative group">
<div class="flex items-center justify-center gap-3">
<div class="text-3xl transform group-hover:scale-110 transition-smooth">
<i class="fas fa-tv"></i>
</div>
<div>
<div class="font-bold text-lg">TV Series</div>
<div class="text-xs opacity-75">Shows & Episodes</div>
</div>
</div>
<div x-show="activeTab === 'series'"
x-transition
class="absolute top-0 right-4 text-xs bg-series-purple text-white px-2 py-1 rounded-full">
Active
</div>
</button>
</div>
</div>
<!-- Search Section with Dynamic Styling -->
<div class="bg-dark-secondary rounded-lg p-6 mb-6 shadow-xl card-hover"
:class="activeTab === 'movies' ? 'border-l-4 border-movie-blue' : 'border-l-4 border-series-purple'">
<!-- Search Header -->
<div class="flex items-center gap-2 mb-4">
<i :class="activeTab === 'movies' ? 'fas fa-search text-movie-blue' : 'fas fa-search text-series-purple'"></i>
<h2 class="text-lg font-semibold">
Search <span x-text="activeTab === 'movies' ? 'Movies' : 'TV Series'"></span>
</h2>
</div>
<div class="flex flex-col md:flex-row gap-4">
<div class="flex-1">
<label class="block text-sm font-medium mb-2 text-gray-300">
<span x-text="activeTab === 'movies' ? 'Movie Title' : 'TV Series Title'"></span>
</label>
<div class="relative">
<input
type="text"
x-model="searchQuery"
@keyup.enter="search()"
:placeholder="activeTab === 'movies' ? 'e.g., Inception' : 'e.g., Breaking Bad'"
class="w-full px-4 py-3 pl-10 bg-dark-tertiary border border-dark-border rounded-lg focus:outline-none focus:ring-2 text-white placeholder-gray-500 transition-smooth"
:class="activeTab === 'movies' ? 'focus:ring-movie-blue focus:border-movie-blue' : 'focus:ring-series-purple focus:border-series-purple'"
>
<i :class="activeTab === 'movies' ? 'fas fa-film text-movie-blue' : 'fas fa-tv text-series-purple'"
class="absolute left-3 top-1/2 transform -translate-y-1/2"></i>
</div>
</div>
</div>
<!-- Action Buttons with Dynamic Colors -->
<div class="flex flex-wrap gap-3 mt-6">
<button
@click="search()"
:disabled="loading"
:class="activeTab === 'movies' ? 'bg-movie-blue hover:bg-blue-600' : 'bg-series-purple hover:bg-purple-700'"
class="px-6 py-3 rounded-lg font-semibold flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed transform hover:scale-105 shadow-lg transition-smooth text-white">
<i class="fas fa-search"></i>
<span>Search <span x-text="activeTab === 'movies' ? 'Movies' : 'Series'"></span></span>
</button>
<button
@click="$refs.fileInput.click()"
:disabled="loading"
class="px-6 py-3 bg-gray-600 hover:bg-gray-700 rounded-lg font-semibold flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed transform hover:scale-105 shadow-lg transition-smooth text-white">
<i class="fas fa-file-upload"></i>
<span>Load List</span>
</button>
<input type="file" x-ref="fileInput" @change="loadList($event)" accept=".txt" class="hidden">
<button
@click="clearAll()"
class="px-6 py-3 bg-red-600 hover:bg-red-700 rounded-lg font-semibold flex items-center gap-2 transform hover:scale-105 shadow-lg transition-smooth text-white">
<i class="fas fa-trash"></i>
<span>Clear</span>
</button>
<button
@click="downloadAllResults()"
x-show="results.length > 0"
x-transition
class="px-6 py-3 bg-green-600 hover:bg-green-700 rounded-lg font-semibold flex items-center gap-2 transform hover:scale-105 shadow-lg transition-smooth text-white">
<i class="fas fa-download"></i>
<span>Download All</span>
</button>
</div>
</div>
<!-- Statistics Cards -->
<div x-show="results.length > 0" x-transition class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="bg-dark-secondary rounded-lg p-4 text-center card-hover">
<div class="text-2xl font-bold" :class="activeTab === 'movies' ? 'text-movie-blue' : 'text-series-purple'">
<span x-text="results.length"></span>
</div>
<div class="text-xs text-gray-400">Total Results</div>
</div>
<div class="bg-dark-secondary rounded-lg p-4 text-center card-hover">
<div class="text-2xl font-bold text-yellow-400">
<span x-text="averageRating"></span>
</div>
<div class="text-xs text-gray-400">Avg Rating</div>
</div>
<div class="bg-dark-secondary rounded-lg p-4 text-center card-hover" x-show="activeTab === 'movies'">
<div class="text-2xl font-bold text-green-400">
<span x-text="totalRuntime"></span>
</div>
<div class="text-xs text-gray-400">Total Runtime</div>
</div>
<div class="bg-dark-secondary rounded-lg p-4 text-center card-hover" x-show="activeTab === 'series'">
<div class="text-2xl font-bold text-orange-400">
<span x-text="totalSeasons"></span>
</div>
<div class="text-xs text-gray-400">Total Seasons</div>
</div>
<div class="bg-dark-secondary rounded-lg p-4 text-center card-hover">
<div class="text-2xl font-bold text-cyan-400">
<span x-text="Object.keys(cache).length"></span>
</div>
<div class="text-xs text-gray-400">Cached Items</div>
</div>
</div>
<!-- Enhanced Status Bar -->
<div x-show="statusMessage" x-transition
class="rounded-lg px-4 py-3 mb-6 flex items-center justify-between shadow-lg"
:class="statusType === 'error' ? 'bg-red-900/50 border border-red-600' :
statusType === 'success' ? 'bg-green-900/50 border border-green-600' :
'bg-dark-tertiary'">
<div class="flex items-center gap-3">
<i :class="statusType === 'error' ? 'fas fa-exclamation-circle text-red-400' :
statusType === 'success' ? 'fas fa-check-circle text-green-400' :
'fas fa-info-circle text-blue-400'"></i>
<span x-text="statusMessage" class="text-sm"></span>
</div>
<span x-show="loading" class="loading-pulse">
<i class="fas fa-spinner fa-spin"></i>
</span>
</div>
<!-- Enhanced Results Table -->
<div class="bg-dark-secondary rounded-lg shadow-xl overflow-hidden card-hover"
x-show="results.length > 0" x-transition>
<div class="p-6">
<h2 class="text-xl font-bold mb-4 flex items-center justify-between">
<div class="flex items-center gap-2">
<i :class="activeTab === 'movies' ? 'fas fa-film text-movie-blue' : 'fas fa-tv text-series-purple'"></i>
<span x-text="activeTab === 'movies' ? 'Movie Results' : 'TV Series Results'"></span>
<span class="text-sm font-normal text-gray-400">(<span x-text="results.length"></span> items)</span>
</div>
<button @click="sortResults()" class="text-sm text-gray-400 hover:text-white transition-smooth">
<i class="fas fa-sort"></i> Sort by Rating
</button>
</h2>
<div class="overflow-x-auto">
<table class="w-full text-left">
<thead class="bg-dark-tertiary">
<tr>
<th class="px-4 py-3 font-semibold text-gray-300">
<i :class="activeTab === 'movies' ? 'fas fa-film text-movie-blue mr-2' : 'fas fa-tv text-series-purple mr-2'"></i>
Title
</th>
<th class="px-4 py-3 font-semibold text-gray-300 hidden md:table-cell">
<i class="fas fa-calendar mr-2"></i>
<span x-text="activeTab === 'movies' ? 'Year' : 'First Aired'"></span>
</th>
<th class="px-4 py-3 font-semibold text-gray-300 hidden lg:table-cell">
<i :class="activeTab === 'movies' ? 'fas fa-user mr-2' : 'fas fa-info-circle mr-2'"></i>
<span x-text="activeTab === 'movies' ? 'Director' : 'Status'"></span>
</th>
<th class="px-4 py-3 font-semibold text-gray-300">
<i class="fas fa-star text-yellow-400 mr-2"></i>
Rating
</th>
<th class="px-4 py-3 font-semibold text-gray-300 hidden xl:table-cell">
<i :class="activeTab === 'movies' ? 'fas fa-tags mr-2' : 'fas fa-layer-group mr-2'"></i>
<span x-text="activeTab === 'movies' ? 'Genres' : 'Seasons'"></span>
</th>
<th class="px-4 py-3 font-semibold text-gray-300 text-center">
<i class="fas fa-cog mr-2"></i>
Actions
</th>
</tr>
</thead>
<tbody class="divide-y divide-dark-border">
<template x-for="item in results" :key="item.id">
<tr class="hover:bg-dark-tertiary cursor-pointer transition-smooth group">
<td class="px-4 py-3">
<div class="flex items-center gap-2">
<div class="w-1 h-8 rounded-full opacity-0 group-hover:opacity-100 transition-smooth"
:class="activeTab === 'movies' ? 'bg-movie-blue' : 'bg-series-purple'"></div>
<div>
<div class="font-medium" x-text="item.title || item.name"></div>
<div class="text-xs text-gray-400 md:hidden"
x-text="item.release_date?.substring(0, 4) || item.first_air_date?.substring(0, 4)"></div>
</div>
</div>
</td>
<td class="px-4 py-3 hidden md:table-cell"
x-text="item.release_date?.substring(0, 4) || item.first_air_date?.substring(0, 4) || 'N/A'"></td>
<td class="px-4 py-3 hidden lg:table-cell">
<span x-text="item.director || item.status || 'N/A'"
:class="item.status === 'Ended' ? 'text-red-400' :
item.status === 'Returning Series' ? 'text-green-400' : ''"></span>
</td>
<td class="px-4 py-3">
<div class="flex items-center gap-1">
<i class="fas fa-star text-yellow-400 text-sm"></i>
<span class="font-semibold" x-text="item.vote_average?.toFixed(1) || 'N/A'"></span>
</div>
</td>
<td class="px-4 py-3 hidden xl:table-cell">
<template x-if="activeTab === 'movies'">
<div class="flex flex-wrap gap-1">
<template x-for="genre in (item.genres || []).slice(0, 3)" :key="genre">
<span class="text-xs bg-movie-blue/20 text-movie-blue px-2 py-1 rounded"
x-text="genre"></span>
</template>
</div>
</template>
<template x-if="activeTab === 'series'">
<div class="flex items-center gap-2">
<span class="text-sm font-semibold" x-text="item.number_of_seasons"></span>
<span class="text-xs text-gray-400">seasons</span>
</div>
</template>
</td>
<td class="px-4 py-3">
<div class="flex gap-2 justify-center">
<button
@click="viewDetails(item)"
class="p-2 rounded text-sm transition-smooth hover:scale-110"
:class="activeTab === 'movies' ? 'bg-movie-blue hover:bg-blue-600' : 'bg-series-purple hover:bg-purple-700'"
title="View Details">
<i class="fas fa-eye"></i>
</button>
<button
@click="downloadItem(item)"
class="p-2 bg-green-600 hover:bg-green-700 rounded text-sm transition-smooth hover:scale-110"
title="Download">
<i class="fas fa-download"></i>
</button>
</div>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
<!-- Enhanced Details Modal -->
<div x-show="selectedItem" x-transition @click.away="selectedItem = null"
class="fixed inset-0 bg-black bg-opacity-75 backdrop-blur-sm flex items-center justify-center p-4 z-50"
x-cloak>
<div class="bg-dark-secondary rounded-lg max-w-4xl w-full max-h-[90vh] overflow-y-auto shadow-2xl"
@click.stop>
<template x-if="selectedItem">
<div>
<!-- Modal Header with Gradient -->
<div class="sticky top-0 bg-gradient-to-r p-6 flex justify-between items-center"
:class="selectedItem.title ? 'from-movie-blue/20 to-transparent' : 'from-series-purple/20 to-transparent'">
<h3 class="text-2xl font-bold flex items-center gap-3">
<i :class="selectedItem.title ? 'fas fa-film text-movie-blue' : 'fas fa-tv text-series-purple'"></i>
<span x-text="selectedItem.title || selectedItem.name"></span>
</h3>
<button @click="selectedItem = null"
class="text-gray-400 hover:text-white transition-smooth hover:rotate-90">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<!-- Modal Content -->
<div class="p-6">
<div class="grid md:grid-cols-3 gap-6">
<!-- Poster with Shadow -->
<div class="md:col-span-1">
<img :src="selectedItem.poster_url"
:alt="selectedItem.title || selectedItem.name"
class="w-full rounded-lg shadow-2xl"
onerror="this.src='https://via.placeholder.com/300x450?text=No+Poster'">
<div class="mt-4 flex gap-2">
<button @click="downloadItem(selectedItem)"
class="flex-1 px-4 py-2 bg-green-600 hover:bg-green-700 rounded-lg font-semibold transition-smooth">
<i class="fas fa-download mr-2"></i>Download
</button>
</div>
</div>
<!-- Details Grid -->
<div class="md:col-span-2 space-y-4">
<!-- Movie Details -->
<template x-if="selectedItem.title">
<div class="grid grid-cols-2 gap-4">
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Release Date</span>
<div class="font-semibold" x-text="selectedItem.release_date || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Runtime</span>
<div class="font-semibold" x-text="(selectedItem.runtime || 'N/A') + ' min'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Director</span>
<div class="font-semibold" x-text="selectedItem.director || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Rating</span>
<div class="font-semibold flex items-center gap-1">
<i class="fas fa-star text-yellow-400"></i>
<span x-text="(selectedItem.vote_average?.toFixed(1) || 'N/A') + '/10'"></span>
</div>
</div>
</div>
</template>
<!-- TV Series Details -->
<template x-if="selectedItem.name">
<div class="grid grid-cols-2 gap-4">
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">First Aired</span>
<div class="font-semibold" x-text="selectedItem.first_air_date || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Status</span>
<div class="font-semibold" x-text="selectedItem.status || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Seasons</span>
<div class="font-semibold" x-text="selectedItem.number_of_seasons || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3">
<span class="text-xs text-gray-400">Episodes</span>
<div class="font-semibold" x-text="selectedItem.number_of_episodes || 'N/A'"></div>
</div>
<div class="bg-dark-tertiary rounded-lg p-3 col-span-2">
<span class="text-xs text-gray-400">Created By</span>
<div class="font-semibold" x-text="(selectedItem.created_by || []).join(', ') || 'N/A'"></div>
</div>
</div>
</template>
<!-- Common Details -->
<div class="space-y-3">
<div>
<h4 class="text-sm text-gray-400 mb-1">Genres</h4>
<div class="flex flex-wrap gap-2">
<template x-for="genre in (selectedItem.genres || [])" :key="genre">
<span class="px-3 py-1 rounded-full text-sm"
:class="selectedItem.title ? 'bg-movie-blue/20 text-movie-blue' : 'bg-series-purple/20 text-series-purple'"
x-text="genre"></span>
</template>
</div>
</div>
<div x-show="selectedItem.actors">
<h4 class="text-sm text-gray-400 mb-1">Cast</h4>
<p class="text-sm" x-text="(selectedItem.actors || []).join(', ') || 'N/A'"></p>
</div>
<div>
<h4 class="text-sm text-gray-400 mb-2">Overview</h4>
<p class="text-sm leading-relaxed bg-dark-tertiary rounded-lg p-4"
x-text="selectedItem.overview || 'No overview available'"></p>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
</div>
<!-- Footer -->
<footer class="text-center py-6 mt-12 text-gray-400 text-sm">
<div class="flex items-center justify-center gap-2 mb-2">
<i class="fas fa-film text-movie-blue"></i>
<span class="text-gray-600">•</span>
<i class="fas fa-tv text-series-purple"></i>
</div>
<p>© 2025 ByteFlowCmd | Powered by TMDB API</p>
<p class="text-xs mt-2 opacity-75">Download Movies & TV Series Information</p>
</footer>
</div>
<script>
function mediaApp() {
return {
// TMDB API Configuration
apiKey: '12cf39a5a9e5a2199b5a659a70f158c2',
baseUrl: 'https://api.themoviedb.org/3',
imageBaseUrl: 'https://image.tmdb.org/t/p',
// App State
activeTab: 'movies', // 'movies' or 'series'
searchQuery: '',
results: [],
selectedItem: null,
loading: false,
statusMessage: '',
statusType: 'info', // 'info', 'success', 'error'
cache: {},
// Computed Statistics
get averageRating() {
if (this.results.length === 0) return '0.0';
const sum = this.results.reduce((acc, item) => acc + (item.vote_average || 0), 0);
return (sum / this.results.length).toFixed(1);
},
get totalRuntime() {
const sum = this.results.reduce((acc, movie) => acc + (movie.runtime || 0), 0);
const hours = Math.floor(sum / 60);
const minutes = sum % 60;
return `${hours}h ${minutes}m`;
},
get totalSeasons() {
return this.results.reduce((acc, series) => acc + (series.number_of_seasons || 0), 0);
},
init() {
this.showStatus('Welcome to Media Scraper Pro! Ready to search...', 'success');
this.testApiConnection();
},
switchTab(tab) {
this.activeTab = tab;
this.clearAll();
this.showStatus(`Switched to ${tab === 'movies' ? 'Movies' : 'TV Series'} mode`, 'info');
},
async testApiConnection() {
try {
const response = await fetch(`${this.baseUrl}/configuration?api_key=${this.apiKey}`);
if (!response.ok) {
this.showStatus('⚠️ API connection issue. Please check API key.', 'error');
}
} catch (error) {
console.error('API test failed:', error);
this.showStatus('Failed to connect to TMDB API', 'error');
}
},
async search() {
if (this.activeTab === 'movies') {
await this.searchMovies();
} else {
await this.searchTVSeries();
}
},
async searchMovies() {
if (!this.searchQuery.trim()) {
this.showStatus('Please enter a movie title', 'error');
return;
}
this.loading = true;
this.results = [];
const match = this.searchQuery.match(/(.+?)\s*KATEX_INLINE_OPEN(\d{4})KATEX_INLINE_CLOSE/);
let title, year;
if (match) {
title = match[1].trim();
year = match[2];
} else {
title = this.searchQuery.trim();
year = null;
}
this.showStatus(`🔍 Searching for movies: "${title}"${year ? ` (${year})` : ''}...`, 'info');
try {
const cacheKey = `movie_${title}_${year || ''}`;
if (this.cache[cacheKey]) {
this.results = this.cache[cacheKey];
this.showStatus(`✅ Found ${this.results.length} cached movie results`, 'success');
this.loading = false;
return;
}
const searchUrl = `${this.baseUrl}/search/movie?api_key=${this.apiKey}&query=${encodeURIComponent(title)}${year ? `&year=${year}` : ''}`;
const response = await fetch(searchUrl);
const data = await response.json();
if (data.results && data.results.length > 0) {
const detailedMovies = await Promise.all(
data.results.slice(0, 10).map(movie => this.getMovieDetails(movie.id))
);
this.results = detailedMovies.filter(movie => movie !== null);
this.cache[cacheKey] = this.results;
this.showStatus(`✅ Found ${this.results.length} movies`, 'success');
} else {
this.showStatus('No movies found', 'error');
}
} catch (error) {
console.error('Search error:', error);
this.showStatus('Search failed. Please try again.', 'error');
} finally {
this.loading = false;
}
},
async searchTVSeries() {
if (!this.searchQuery.trim()) {
this.showStatus('Please enter a TV series title', 'error');
return;
}
this.loading = true;
this.results = [];
const match = this.searchQuery.match(/(.+?)\s*KATEX_INLINE_OPEN(\d{4})KATEX_INLINE_CLOSE/);
let title, year;
if (match) {
title = match[1].trim();
year = match[2];
} else {
title = this.searchQuery.trim();
year = null;
}
this.showStatus(`🔍 Searching for TV series: "${title}"${year ? ` (${year})` : ''}...`, 'info');
try {
const cacheKey = `series_${title}_${year || ''}`;
if (this.cache[cacheKey]) {
this.results = this.cache[cacheKey];
this.showStatus(`✅ Found ${this.results.length} cached TV series results`, 'success');
this.loading = false;
return;
}
const searchUrl = `${this.baseUrl}/search/tv?api_key=${this.apiKey}&query=${encodeURIComponent(title)}${year ? `&first_air_date_year=${year}` : ''}`;
const response = await fetch(searchUrl);
const data = await response.json();
if (data.results && data.results.length > 0) {
const detailedSeries = await Promise.all(
data.results.slice(0, 5).map(series => this.getSeriesDetails(series.id))
);
this.results = detailedSeries.filter(series => series !== null);
this.cache[cacheKey] = this.results;
this.showStatus(`✅ Found ${this.results.length} TV series`, 'success');
} else {
this.showStatus('No TV series found', 'error');
}
} catch (error) {
console.error('Search error:', error);
this.showStatus('Search failed. Please try again.', 'error');
} finally {
this.loading = false;
}
},
async getMovieDetails(movieId) {
try {
const movieResponse = await fetch(`${this.baseUrl}/movie/${movieId}?api_key=${this.apiKey}`);
const movieData = await movieResponse.json();
const creditsResponse = await fetch(`${this.baseUrl}/movie/${movieId}/credits?api_key=${this.apiKey}`);
const creditsData = await creditsResponse.json();
const director = creditsData.crew?.find(person => person.job === 'Director');
const actors = creditsData.cast?.slice(0, 5).map(actor => actor.name);
return {
id: movieData.id,
title: movieData.title,
original_title: movieData.original_title,
overview: movieData.overview,
release_date: movieData.release_date,
runtime: movieData.runtime,
vote_average: movieData.vote_average,
genres: movieData.genres?.map(g => g.name),
director: director?.name,
actors: actors,
poster_path: movieData.poster_path,
backdrop_path: movieData.backdrop_path,
poster_url: movieData.poster_path ? `${this.imageBaseUrl}/w342${movieData.poster_path}` : null,
backdrop_url: movieData.backdrop_path ? `${this.imageBaseUrl}/w780${movieData.backdrop_path}` : null
};
} catch (error) {
console.error(`Error fetching movie ${movieId}:`, error);
return null;
}
},
async getSeriesDetails(seriesId) {
try {
const seriesResponse = await fetch(`${this.baseUrl}/tv/${seriesId}?api_key=${this.apiKey}`);
const seriesData = await seriesResponse.json();
const creditsResponse = await fetch(`${this.baseUrl}/tv/${seriesId}/credits?api_key=${this.apiKey}`);
const creditsData = await creditsResponse.json();
const contentRatingsResponse = await fetch(`${this.baseUrl}/tv/${seriesId}/content_ratings?api_key=${this.apiKey}`);
const ratingsData = await contentRatingsResponse.json();
let contentRating = 'N/A';
for (const rating of ratingsData.results || []) {
if (rating.iso_3166_1 === 'US') {
contentRating = rating.rating;
break;
}
}
// Get all episodes for all seasons
const episodes = [];
for (let i = 1; i <= seriesData.number_of_seasons; i++) {
const seasonEpisodes = await this.getSeasonEpisodes(seriesId, i);
episodes.push(...seasonEpisodes);
}
return {
id: seriesData.id,
name: seriesData.name,
original_name: seriesData.original_name,
overview: seriesData.overview,
first_air_date: seriesData.first_air_date,
last_air_date: seriesData.last_air_date,
status: seriesData.status,
vote_average: seriesData.vote_average,
genres: seriesData.genres?.map(g => g.name),
number_of_seasons: seriesData.number_of_seasons,
number_of_episodes: seriesData.number_of_episodes,
content_rating: contentRating,
created_by: seriesData.created_by?.map(c => c.name),
networks: seriesData.networks?.map(n => n.name),
episode_run_time: seriesData.episode_run_time,
poster_path: seriesData.poster_path,
backdrop_path: seriesData.backdrop_path,
poster_url: seriesData.poster_path ? `${this.imageBaseUrl}/w342${seriesData.poster_path}` : null,
backdrop_url: seriesData.backdrop_path ? `${this.imageBaseUrl}/w780${seriesData.backdrop_path}` : null,
all_episodes: episodes
};
} catch (error) {
console.error(`Error fetching series ${seriesId}:`, error);
return null;
}
},
async getSeasonEpisodes(seriesId, seasonNumber) {
try {
const response = await fetch(`${this.baseUrl}/tv/${seriesId}/season/${seasonNumber}?api_key=${this.apiKey}`);
const data = await response.json();
return data.episodes?.map(ep => ({
season_number: seasonNumber,
episode_number: ep.episode_number,
name: ep.name,
overview: ep.overview,
air_date: ep.air_date,
runtime: ep.runtime,
vote_average: ep.vote_average
})) || [];
} catch (error) {
console.error(`Error fetching season ${seasonNumber}:`, error);
return [];
}
},
async loadList(event) {
const file = event.target.files[0];
if (!file) return;
this.loading = true;
const itemType = this.activeTab === 'movies' ? 'movies' : 'TV series';
this.showStatus(`📂 Loading ${itemType} list from file...`, 'info');
try {
const text = await file.text();
const lines = text.split('\n').filter(line => line.trim());
this.results = [];
let processed = 0;
for (const line of lines) {
const match = line.match(/(.+?)\s*KATEX_INLINE_OPEN(\d{4})KATEX_INLINE_CLOSE/);
let title, year;
if (match) {
title = match[1].trim();
year = match[2];
} else {
title = line.trim();
year = null;
}
this.showStatus(`Processing ${++processed}/${lines.length}: ${title}`, 'info');
if (this.activeTab === 'movies') {
const searchUrl = `${this.baseUrl}/search/movie?api_key=${this.apiKey}&query=${encodeURIComponent(title)}${year ? `&year=${year}` : ''}`;
const response = await fetch(searchUrl);
const data = await response.json();
if (data.results && data.results.length > 0) {
const movieDetails = await this.getMovieDetails(data.results[0].id);
if (movieDetails) {
this.results.push(movieDetails);
}
}
} else {
const searchUrl = `${this.baseUrl}/search/tv?api_key=${this.apiKey}&query=${encodeURIComponent(title)}${year ? `&first_air_date_year=${year}` : ''}`;
const response = await fetch(searchUrl);
const data = await response.json();
if (data.results && data.results.length > 0) {
const seriesDetails = await this.getSeriesDetails(data.results[0].id);
if (seriesDetails) {
this.results.push(seriesDetails);
}
}
}
await new Promise(resolve => setTimeout(resolve, 250));
}
this.showStatus(`✅ Successfully loaded ${this.results.length} ${itemType} from file`, 'success');
} catch (error) {
console.error('Error loading file:', error);
this.showStatus('Failed to load file', 'error');
} finally {
this.loading = false;
event.target.value = '';
}
},
viewDetails(item) {
this.selectedItem = item;
},
async downloadItem(item) {
const itemType = item.title ? 'movie' : 'TV series';
this.showStatus(`⬇️ Preparing download for ${item.title || item.name}...`, 'info');
try {
const zip = new JSZip();
const folderName = this.sanitizeFilename(
`${item.title || item.name} (${item.release_date?.substring(0, 4) || item.first_air_date?.substring(0, 4) || 'Unknown'})`
);
// Create info text file
const infoText = item.title ? this.createMovieInfoText(item) : this.createSeriesInfoText(item);
zip.file(`${folderName}/${item.title ? 'movie' : 'series'}_info.txt`, infoText);
// Add episodes list for TV series
if (item.name && item.all_episodes) {
const episodesText = this.createEpisodesListText(item.all_episodes);
zip.file(`${folderName}/episodes_list.txt`, episodesText);
}
// Try to download images
if (item.poster_url) {
try {
const posterBlob = await this.fetchImage(item.poster_url);
zip.file(`${folderName}/poster.jpg`, posterBlob);
} catch (error) {
console.error('Failed to download poster:', error);
}
}
if (item.backdrop_url) {
try {
const backdropBlob = await this.fetchImage(item.backdrop_url);
zip.file(`${folderName}/backdrop.jpg`, backdropBlob);
} catch (error) {
console.error('Failed to download backdrop:', error);
}
}
const content = await zip.generateAsync({type: 'blob'});
saveAs(content, `${folderName}.zip`);
this.showStatus(`✅ Downloaded: ${item.title || item.name}`, 'success');
} catch (error) {
console.error('Download error:', error);
this.showStatus('Download failed', 'error');
}
},
async downloadAllResults() {
if (this.results.length === 0) return;
this.loading = true;
const itemType = this.activeTab === 'movies' ? 'Movies' : 'TV_Series';
this.showStatus(`⬇️ Preparing batch download for ${this.results.length} items...`, 'info');
try {
const zip = new JSZip();
for (let i = 0; i < this.results.length; i++) {
const item = this.results[i];
this.showStatus(`Processing ${i + 1}/${this.results.length}: ${item.title || item.name}`, 'info');
const folderName = this.sanitizeFilename(
`${item.title || item.name} (${item.release_date?.substring(0, 4) || item.first_air_date?.substring(0, 4) || 'Unknown'})`
);
// Add info files
const infoText = item.title ? this.createMovieInfoText(item) : this.createSeriesInfoText(item);
zip.file(`${itemType}/${folderName}/${item.title ? 'movie' : 'series'}_info.txt`, infoText);
if (item.name && item.all_episodes) {
const episodesText = this.createEpisodesListText(item.all_episodes);
zip.file(`${itemType}/${folderName}/episodes_list.txt`, episodesText);
}
await new Promise(resolve => setTimeout(resolve, 100));
}
const content = await zip.generateAsync({type: 'blob'});
saveAs(content, `${itemType}_Collection_${new Date().toISOString().split('T')[0]}.zip`);
this.showStatus(`✅ Downloaded collection of ${this.results.length} ${itemType.toLowerCase()}`, 'success');
} catch (error) {
console.error('Batch download error:', error);
this.showStatus('Batch download failed', 'error');
} finally {
this.loading = false;
}
},
createMovieInfoText(movie) {
const separator = '='.repeat(60);
const date = new Date().toLocaleString();
return `${separator}
MOVIE INFORMATION
${separator}